compiler/libec: Fixed a uninitialized variable Valgrind complaint
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 #if defined(__GNUC__)
2 typedef long long int64;
3 typedef unsigned long long uint64;
4 #elif defined(__TINYC__)
5 #include <stdarg.h>
6 #define __builtin_va_list va_list
7 #define __builtin_va_start va_start
8 #define __builtin_va_end va_end
9 #ifdef _WIN32
10 #define strcasecmp stricmp
11 #define strncasecmp strnicmp
12 #define __declspec(x) __attribute__((x))
13 #endif
14 typedef long long int64;
15 typedef unsigned long long uint64;
16 #else
17 typedef __int64 int64;
18 typedef unsigned __int64 uint64;
19 #endif
20 #ifdef __BIG_ENDIAN__
21 #define __ENDIAN_PAD(x) (8 - (x))
22 #else
23 #define __ENDIAN_PAD(x) 0
24 #endif
25 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
26
27 struct __ecereNameSpace__ecere__sys__BTNode;
28
29 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
30
31 struct __ecereNameSpace__ecere__sys__BinaryTree
32 {
33 struct __ecereNameSpace__ecere__sys__BTNode * root;
34 int count;
35 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, unsigned int a, unsigned int b);
36 void (*  FreeKey)(void *  key);
37 } __attribute__ ((gcc_struct));
38
39 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
40
41 struct __ecereNameSpace__ecere__sys__OldList
42 {
43 void *  first;
44 void *  last;
45 int count;
46 unsigned int offset;
47 unsigned int circ;
48 } __attribute__ ((gcc_struct));
49
50 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
51
52 struct __ecereNameSpace__ecere__com__Method
53 {
54 char *  name;
55 struct __ecereNameSpace__ecere__com__Method * parent;
56 struct __ecereNameSpace__ecere__com__Method * left;
57 struct __ecereNameSpace__ecere__com__Method * right;
58 int depth;
59 int (*  function)();
60 int vid;
61 int type;
62 struct __ecereNameSpace__ecere__com__Class * _class;
63 void *  symbol;
64 char *  dataTypeString;
65 struct Type * dataType;
66 int memberAccess;
67 } __attribute__ ((gcc_struct));
68
69 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
70
71 struct __ecereNameSpace__ecere__com__Property
72 {
73 struct __ecereNameSpace__ecere__com__Property * prev;
74 struct __ecereNameSpace__ecere__com__Property * next;
75 char *  name;
76 unsigned int isProperty;
77 int memberAccess;
78 int id;
79 struct __ecereNameSpace__ecere__com__Class * _class;
80 char *  dataTypeString;
81 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
82 struct Type * dataType;
83 void (*  Set)();
84 int (*  Get)();
85 unsigned int (*  IsSet)();
86 void *  data;
87 void *  symbol;
88 int vid;
89 unsigned int conversion;
90 unsigned int watcherOffset;
91 char *  category;
92 unsigned int compiled;
93 unsigned int selfWatchable;
94 unsigned int isWatchable;
95 } __attribute__ ((gcc_struct));
96
97 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
98
99 struct CodePosition
100 {
101 int line;
102 int charPos;
103 int pos;
104 unsigned int included;
105 } __attribute__ ((gcc_struct));
106
107 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
108
109 struct Location
110 {
111 struct CodePosition start;
112 struct CodePosition end;
113 } __attribute__ ((gcc_struct));
114
115 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
116
117 struct Attrib;
118
119 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
120
121 struct ExtDecl
122 {
123 struct Location loc;
124 int type;
125 union
126 {
127 char * s;
128 struct Attrib * attr;
129 } __attribute__ ((gcc_struct));
130 } __attribute__ ((gcc_struct));
131
132 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
133
134 struct ClassDefinition
135 {
136 struct ClassDefinition * prev;
137 struct ClassDefinition * next;
138 struct Location loc;
139 struct Specifier * _class;
140 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
141 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
142 struct Symbol * symbol;
143 struct Location blockStart;
144 struct Location nameLoc;
145 int endid;
146 int declMode;
147 unsigned int deleteWatchable;
148 } __attribute__ ((gcc_struct));
149
150 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
151
152 struct Context
153 {
154 struct Context * parent;
155 struct __ecereNameSpace__ecere__sys__BinaryTree types;
156 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
157 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
158 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
159 int nextID;
160 int simpleID;
161 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
162 struct ClassDefinition * classDef;
163 unsigned int templateTypesOnly;
164 unsigned int hasNameSpace;
165 } __attribute__ ((gcc_struct));
166
167 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
168
169 struct Instantiation
170 {
171 struct Instantiation * prev;
172 struct Instantiation * next;
173 struct Location loc;
174 struct Specifier * _class;
175 struct Expression * exp;
176 struct __ecereNameSpace__ecere__sys__OldList *  members;
177 struct Symbol * symbol;
178 unsigned int fullSet;
179 unsigned int isConstant;
180 unsigned char *  data;
181 struct Location nameLoc;
182 struct Location insideLoc;
183 unsigned int built;
184 } __attribute__ ((gcc_struct));
185
186 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
187
188 struct Declaration
189 {
190 struct Declaration * prev;
191 struct Declaration * next;
192 struct Location loc;
193 int type;
194 union
195 {
196 struct
197 {
198 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
199 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
200 } __attribute__ ((gcc_struct));
201 struct Instantiation * inst;
202 struct
203 {
204 struct Identifier * id;
205 struct Expression * exp;
206 } __attribute__ ((gcc_struct));
207 } __attribute__ ((gcc_struct));
208 struct Specifier * extStorage;
209 struct Symbol * symbol;
210 int declMode;
211 } __attribute__ ((gcc_struct));
212
213 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
214
215 struct Statement
216 {
217 struct Statement * prev;
218 struct Statement * next;
219 struct Location loc;
220 int type;
221 union
222 {
223 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
224 struct
225 {
226 struct Identifier * id;
227 struct Statement * stmt;
228 } __attribute__ ((gcc_struct)) labeled;
229 struct
230 {
231 struct Expression * exp;
232 struct Statement * stmt;
233 } __attribute__ ((gcc_struct)) caseStmt;
234 struct
235 {
236 struct __ecereNameSpace__ecere__sys__OldList * declarations;
237 struct __ecereNameSpace__ecere__sys__OldList * statements;
238 struct Context * context;
239 unsigned int isSwitch;
240 } __attribute__ ((gcc_struct)) compound;
241 struct
242 {
243 struct __ecereNameSpace__ecere__sys__OldList * exp;
244 struct Statement * stmt;
245 struct Statement * elseStmt;
246 } __attribute__ ((gcc_struct)) ifStmt;
247 struct
248 {
249 struct __ecereNameSpace__ecere__sys__OldList * exp;
250 struct Statement * stmt;
251 } __attribute__ ((gcc_struct)) switchStmt;
252 struct
253 {
254 struct __ecereNameSpace__ecere__sys__OldList * exp;
255 struct Statement * stmt;
256 } __attribute__ ((gcc_struct)) whileStmt;
257 struct
258 {
259 struct __ecereNameSpace__ecere__sys__OldList * exp;
260 struct Statement * stmt;
261 } __attribute__ ((gcc_struct)) doWhile;
262 struct
263 {
264 struct Statement * init;
265 struct Statement * check;
266 struct __ecereNameSpace__ecere__sys__OldList * increment;
267 struct Statement * stmt;
268 } __attribute__ ((gcc_struct)) forStmt;
269 struct
270 {
271 struct Identifier * id;
272 } __attribute__ ((gcc_struct)) gotoStmt;
273 struct
274 {
275 struct Specifier * spec;
276 char * statements;
277 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
278 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
279 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
280 } __attribute__ ((gcc_struct)) asmStmt;
281 struct
282 {
283 struct Expression * watcher;
284 struct Expression * object;
285 struct __ecereNameSpace__ecere__sys__OldList * watches;
286 } __attribute__ ((gcc_struct)) _watch;
287 struct
288 {
289 struct Identifier * id;
290 struct __ecereNameSpace__ecere__sys__OldList * exp;
291 struct __ecereNameSpace__ecere__sys__OldList * filter;
292 struct Statement * stmt;
293 } __attribute__ ((gcc_struct)) forEachStmt;
294 struct Declaration * decl;
295 } __attribute__ ((gcc_struct));
296 } __attribute__ ((gcc_struct));
297
298 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
299
300 struct TypeName
301 {
302 struct TypeName * prev;
303 struct TypeName * next;
304 struct Location loc;
305 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
306 struct Declarator * declarator;
307 int classObjectType;
308 struct Expression * bitCount;
309 } __attribute__ ((gcc_struct));
310
311 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
312
313 struct Initializer
314 {
315 struct Initializer * prev;
316 struct Initializer * next;
317 struct Location loc;
318 int type;
319 union
320 {
321 struct Expression * exp;
322 struct __ecereNameSpace__ecere__sys__OldList *  list;
323 } __attribute__ ((gcc_struct));
324 unsigned int isConstant;
325 } __attribute__ ((gcc_struct));
326
327 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
328
329 struct __ecereNameSpace__ecere__com__DataValue
330 {
331 union
332 {
333 char c;
334 unsigned char uc;
335 short s;
336 unsigned short us;
337 int i;
338 unsigned int ui;
339 void *  p;
340 float f;
341 double d;
342 long long i64;
343 uint64 ui64;
344 } __attribute__ ((gcc_struct));
345 } __attribute__ ((gcc_struct));
346
347 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
348
349 struct Expression
350 {
351 struct Expression * prev;
352 struct Expression * next;
353 struct Location loc;
354 int type;
355 union
356 {
357 struct
358 {
359 char *  constant;
360 struct Identifier * identifier;
361 } __attribute__ ((gcc_struct));
362 struct Statement * compound;
363 struct Instantiation * instance;
364 char *  string;
365 struct __ecereNameSpace__ecere__sys__OldList *  list;
366 struct
367 {
368 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
369 struct Declarator * decl;
370 } __attribute__ ((gcc_struct)) _classExp;
371 struct
372 {
373 struct Identifier * id;
374 } __attribute__ ((gcc_struct)) classData;
375 struct
376 {
377 struct Expression * exp;
378 struct __ecereNameSpace__ecere__sys__OldList * arguments;
379 struct Location argLoc;
380 } __attribute__ ((gcc_struct)) call;
381 struct
382 {
383 struct Expression * exp;
384 struct __ecereNameSpace__ecere__sys__OldList * index;
385 } __attribute__ ((gcc_struct)) index;
386 struct
387 {
388 struct Expression * exp;
389 struct Identifier * member;
390 int memberType;
391 unsigned int thisPtr;
392 } __attribute__ ((gcc_struct)) member;
393 struct
394 {
395 int op;
396 struct Expression * exp1;
397 struct Expression * exp2;
398 } __attribute__ ((gcc_struct)) op;
399 struct TypeName * typeName;
400 struct Specifier * _class;
401 struct
402 {
403 struct TypeName * typeName;
404 struct Expression * exp;
405 } __attribute__ ((gcc_struct)) cast;
406 struct
407 {
408 struct Expression * cond;
409 struct __ecereNameSpace__ecere__sys__OldList * exp;
410 struct Expression * elseExp;
411 } __attribute__ ((gcc_struct)) cond;
412 struct
413 {
414 struct TypeName * typeName;
415 struct Expression * size;
416 } __attribute__ ((gcc_struct)) _new;
417 struct
418 {
419 struct TypeName * typeName;
420 struct Expression * size;
421 struct Expression * exp;
422 } __attribute__ ((gcc_struct)) _renew;
423 struct
424 {
425 char * table;
426 struct Identifier * id;
427 } __attribute__ ((gcc_struct)) db;
428 struct
429 {
430 struct Expression * ds;
431 struct Expression * name;
432 } __attribute__ ((gcc_struct)) dbopen;
433 struct
434 {
435 struct TypeName * typeName;
436 struct Initializer * initializer;
437 } __attribute__ ((gcc_struct)) initializer;
438 struct
439 {
440 struct Expression * exp;
441 struct TypeName * typeName;
442 } __attribute__ ((gcc_struct)) vaArg;
443 } __attribute__ ((gcc_struct));
444 unsigned int debugValue;
445 struct __ecereNameSpace__ecere__com__DataValue val;
446 unsigned int address;
447 unsigned int hasAddress;
448 struct Type * expType;
449 struct Type * destType;
450 unsigned int usage;
451 int tempCount;
452 unsigned int byReference;
453 unsigned int isConstant;
454 unsigned int addedThis;
455 unsigned int needCast;
456 unsigned int thisPtr;
457 } __attribute__ ((gcc_struct));
458
459 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
460
461 struct TemplateDatatype
462 {
463 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
464 struct Declarator * decl;
465 } __attribute__ ((gcc_struct));
466
467 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
468
469 struct TemplateArgument;
470
471 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
472
473 struct TemplateParameter
474 {
475 struct TemplateParameter * prev;
476 struct TemplateParameter * next;
477 struct Location loc;
478 int type;
479 struct Identifier * identifier;
480 union
481 {
482 struct TemplateDatatype * dataType;
483 int memberType;
484 } __attribute__ ((gcc_struct));
485 struct TemplateArgument * defaultArgument;
486 char *  dataTypeString;
487 struct Type * baseType;
488 } __attribute__ ((gcc_struct));
489
490 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
491
492 struct Specifier
493 {
494 struct Specifier * prev;
495 struct Specifier * next;
496 struct Location loc;
497 int type;
498 union
499 {
500 int specifier;
501 struct
502 {
503 struct ExtDecl * extDecl;
504 char *  name;
505 struct Symbol * symbol;
506 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
507 } __attribute__ ((gcc_struct));
508 struct
509 {
510 struct Identifier * id;
511 struct __ecereNameSpace__ecere__sys__OldList *  list;
512 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
513 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
514 unsigned int addNameSpace;
515 struct Context * ctx;
516 } __attribute__ ((gcc_struct));
517 struct Expression * expression;
518 struct Specifier * _class;
519 struct TemplateParameter * templateParameter;
520 } __attribute__ ((gcc_struct));
521 } __attribute__ ((gcc_struct));
522
523 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
524
525 struct Identifier
526 {
527 struct Identifier * prev;
528 struct Identifier * next;
529 struct Location loc;
530 struct Symbol * classSym;
531 struct Specifier * _class;
532 char *  string;
533 struct Identifier * badID;
534 } __attribute__ ((gcc_struct));
535
536 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
537
538 struct Pointer;
539
540 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
541
542 struct Declarator
543 {
544 struct Declarator * prev;
545 struct Declarator * next;
546 struct Location loc;
547 int type;
548 struct Symbol * symbol;
549 struct Declarator * declarator;
550 union
551 {
552 struct Identifier * identifier;
553 struct
554 {
555 struct Expression * exp;
556 struct Expression * posExp;
557 struct Attrib * attrib;
558 } __attribute__ ((gcc_struct)) structDecl;
559 struct
560 {
561 struct Expression * exp;
562 struct Specifier * enumClass;
563 } __attribute__ ((gcc_struct)) array;
564 struct
565 {
566 struct __ecereNameSpace__ecere__sys__OldList * parameters;
567 } __attribute__ ((gcc_struct)) function;
568 struct
569 {
570 struct Pointer * pointer;
571 } __attribute__ ((gcc_struct)) pointer;
572 struct
573 {
574 struct ExtDecl * extended;
575 } __attribute__ ((gcc_struct)) extended;
576 } __attribute__ ((gcc_struct));
577 } __attribute__ ((gcc_struct));
578
579 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
580
581 struct FunctionDefinition
582 {
583 struct FunctionDefinition * prev;
584 struct FunctionDefinition * next;
585 struct Location loc;
586 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
587 struct Declarator * declarator;
588 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
589 struct Statement * body;
590 struct __ecereNameSpace__ecere__com__Class * _class;
591 struct __ecereNameSpace__ecere__sys__OldList attached;
592 int declMode;
593 struct Type * type;
594 struct Symbol * propSet;
595 int tempCount;
596 unsigned int propertyNoThis;
597 } __attribute__ ((gcc_struct));
598
599 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
600
601 struct DBTableDef;
602
603 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
604
605 struct External
606 {
607 struct External * prev;
608 struct External * next;
609 struct Location loc;
610 int type;
611 struct Symbol * symbol;
612 union
613 {
614 struct FunctionDefinition * function;
615 struct ClassDefinition * _class;
616 struct Declaration * declaration;
617 char *  importString;
618 struct Identifier * id;
619 struct DBTableDef * table;
620 } __attribute__ ((gcc_struct));
621 int importType;
622 } __attribute__ ((gcc_struct));
623
624 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
625
626 struct ModuleImport
627 {
628 struct ModuleImport * prev;
629 struct ModuleImport * next;
630 char *  name;
631 struct __ecereNameSpace__ecere__sys__OldList classes;
632 struct __ecereNameSpace__ecere__sys__OldList functions;
633 int importType;
634 int importAccess;
635 } __attribute__ ((gcc_struct));
636
637 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
638
639 struct ClassImport
640 {
641 struct ClassImport * prev;
642 struct ClassImport * next;
643 char *  name;
644 struct __ecereNameSpace__ecere__sys__OldList methods;
645 struct __ecereNameSpace__ecere__sys__OldList properties;
646 unsigned int itself;
647 unsigned int isRemote;
648 } __attribute__ ((gcc_struct));
649
650 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
651
652 struct Symbol
653 {
654 char *  string;
655 struct Symbol * parent;
656 struct Symbol * left;
657 struct Symbol * right;
658 int depth;
659 struct Type * type;
660 union
661 {
662 struct __ecereNameSpace__ecere__com__Method * method;
663 struct __ecereNameSpace__ecere__com__Property * _property;
664 struct __ecereNameSpace__ecere__com__Class * registered;
665 } __attribute__ ((gcc_struct));
666 int id;
667 int idCode;
668 union
669 {
670 struct
671 {
672 struct External * pointerExternal;
673 struct External * structExternal;
674 } __attribute__ ((gcc_struct));
675 struct
676 {
677 struct External * externalGet;
678 struct External * externalSet;
679 struct External * externalPtr;
680 struct External * externalIsSet;
681 } __attribute__ ((gcc_struct));
682 struct
683 {
684 struct External * methodExternal;
685 struct External * methodCodeExternal;
686 } __attribute__ ((gcc_struct));
687 } __attribute__ ((gcc_struct));
688 unsigned int imported;
689 unsigned int declaredStructSym;
690 struct __ecereNameSpace__ecere__com__Class * _class;
691 unsigned int declaredStruct;
692 unsigned int needConstructor;
693 unsigned int needDestructor;
694 char *  constructorName;
695 char *  structName;
696 char *  className;
697 char *  destructorName;
698 struct ModuleImport * module;
699 struct ClassImport * _import;
700 struct Location nameLoc;
701 unsigned int isParam;
702 unsigned int isRemote;
703 unsigned int isStruct;
704 unsigned int fireWatchersDone;
705 int declaring;
706 unsigned int classData;
707 unsigned int isStatic;
708 char *  shortName;
709 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
710 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
711 struct Context * ctx;
712 int isIterator;
713 struct Expression * propCategory;
714 } __attribute__ ((gcc_struct));
715
716 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
717
718 struct Type
719 {
720 struct Type * prev;
721 struct Type * next;
722 int refCount;
723 union
724 {
725 struct Symbol * _class;
726 struct
727 {
728 struct __ecereNameSpace__ecere__sys__OldList members;
729 char *  enumName;
730 } __attribute__ ((gcc_struct));
731 struct
732 {
733 struct Type * returnType;
734 struct __ecereNameSpace__ecere__sys__OldList params;
735 struct Symbol * thisClass;
736 unsigned int staticMethod;
737 struct TemplateParameter * thisClassTemplate;
738 } __attribute__ ((gcc_struct));
739 struct
740 {
741 struct __ecereNameSpace__ecere__com__Method * method;
742 struct __ecereNameSpace__ecere__com__Class * methodClass;
743 struct __ecereNameSpace__ecere__com__Class * usedClass;
744 } __attribute__ ((gcc_struct));
745 struct
746 {
747 struct Type * arrayType;
748 int arraySize;
749 struct Expression * arraySizeExp;
750 unsigned int freeExp;
751 struct Symbol * enumClass;
752 } __attribute__ ((gcc_struct));
753 struct Type * type;
754 struct TemplateParameter * templateParameter;
755 } __attribute__ ((gcc_struct));
756 unsigned int isSigned;
757 int kind;
758 unsigned int constant;
759 unsigned int size;
760 char *  name;
761 char *  typeName;
762 unsigned int count;
763 unsigned int truth;
764 int classObjectType;
765 unsigned int byReference;
766 unsigned int extraParam;
767 int alignment;
768 unsigned int directClassAccess;
769 unsigned int computing;
770 unsigned int dllExport;
771 unsigned int offset;
772 unsigned int keepCast;
773 unsigned int passAsTemplate;
774 int bitFieldCount;
775 } __attribute__ ((gcc_struct));
776
777 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
778
779 struct __ecereNameSpace__ecere__com__Class
780 {
781 struct __ecereNameSpace__ecere__com__Class * prev;
782 struct __ecereNameSpace__ecere__com__Class * next;
783 char *  name;
784 int offset;
785 int structSize;
786 int (* *  _vTbl)();
787 int vTblSize;
788 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
789 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
790 int offsetClass;
791 int sizeClass;
792 struct __ecereNameSpace__ecere__com__Class * base;
793 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
794 struct __ecereNameSpace__ecere__sys__BinaryTree members;
795 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
796 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
797 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
798 struct __ecereNameSpace__ecere__sys__OldList derivatives;
799 int memberID;
800 int startMemberID;
801 int type;
802 struct __ecereNameSpace__ecere__com__Instance * module;
803 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
804 char *  dataTypeString;
805 struct Type * dataType;
806 int typeSize;
807 int defaultAlignment;
808 void (*  Initialize)();
809 int memberOffset;
810 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
811 char *  designerClass;
812 unsigned int noExpansion;
813 char *  defaultProperty;
814 unsigned int comRedefinition;
815 int count;
816 unsigned int isRemote;
817 unsigned int internalDecl;
818 void *  data;
819 unsigned int computeSize;
820 int structAlignment;
821 int destructionWatchOffset;
822 unsigned int fixed;
823 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
824 int inheritanceAccess;
825 char *  fullName;
826 void *  symbol;
827 struct __ecereNameSpace__ecere__sys__OldList conversions;
828 struct __ecereNameSpace__ecere__sys__OldList templateParams;
829 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
830 struct __ecereNameSpace__ecere__com__Class * templateClass;
831 struct __ecereNameSpace__ecere__sys__OldList templatized;
832 int numParams;
833 } __attribute__ ((gcc_struct));
834
835 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
836
837 struct __ecereNameSpace__ecere__com__Instance
838 {
839 int (* *  _vTbl)();
840 struct __ecereNameSpace__ecere__com__Class * _class;
841 int _refCount;
842 } __attribute__ ((gcc_struct));
843
844 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
845
846 struct __ecereNameSpace__ecere__com__DataMember
847 {
848 struct __ecereNameSpace__ecere__com__DataMember * prev;
849 struct __ecereNameSpace__ecere__com__DataMember * next;
850 char *  name;
851 unsigned int isProperty;
852 int memberAccess;
853 int id;
854 struct __ecereNameSpace__ecere__com__Class * _class;
855 char *  dataTypeString;
856 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
857 struct Type * dataType;
858 int type;
859 int offset;
860 int memberID;
861 struct __ecereNameSpace__ecere__sys__OldList members;
862 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
863 int memberOffset;
864 int structAlignment;
865 } __attribute__ ((gcc_struct));
866
867 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
868
869 struct __ecereNameSpace__ecere__com__SerialBuffer
870 {
871 unsigned char *  _buffer;
872 unsigned int count;
873 unsigned int _size;
874 unsigned int pos;
875 } __attribute__ ((gcc_struct));
876
877 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
878
879 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
880 {
881 union
882 {
883 struct
884 {
885 char *  dataTypeString;
886 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
887 } __attribute__ ((gcc_struct));
888 struct __ecereNameSpace__ecere__com__DataValue expression;
889 struct
890 {
891 char *  memberString;
892 union
893 {
894 struct __ecereNameSpace__ecere__com__DataMember * member;
895 struct __ecereNameSpace__ecere__com__Property * prop;
896 struct __ecereNameSpace__ecere__com__Method * method;
897 } __attribute__ ((gcc_struct));
898 } __attribute__ ((gcc_struct));
899 } __attribute__ ((gcc_struct));
900 } __attribute__ ((gcc_struct));
901
902 typedef unsigned int size_t;
903
904 void exit(int status);
905
906 void * calloc(size_t nmemb, size_t size);
907
908 void free(void * ptr);
909
910 void * malloc(size_t size);
911
912 void * realloc(void * ptr, size_t size);
913
914 long int strtol(const char * nptr, char ** endptr, int base);
915
916 long long int strtoll(const char * nptr, char ** endptr, int base);
917
918 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
919
920 enum yytokentype
921 {
922 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
923 };
924
925 typedef union YYSTYPE
926 {
927 int specifierType;
928 int i;
929 int declMode;
930 struct Identifier * id;
931 struct Expression * exp;
932 struct Specifier * specifier;
933 struct __ecereNameSpace__ecere__sys__OldList * list;
934 struct Enumerator * enumerator;
935 struct Declarator * declarator;
936 struct Pointer * pointer;
937 struct Initializer * initializer;
938 struct InitDeclarator * initDeclarator;
939 struct TypeName * typeName;
940 struct Declaration * declaration;
941 struct Statement * stmt;
942 struct FunctionDefinition * function;
943 struct External * external;
944 struct Context * context;
945 struct AsmField * asmField;
946 struct Attrib * attrib;
947 struct ExtDecl * extDecl;
948 struct Attribute * attribute;
949 struct Instantiation * instance;
950 struct MembersInit * membersInit;
951 struct MemberInit * memberInit;
952 struct ClassFunction * classFunction;
953 struct ClassDefinition * _class;
954 struct ClassDef * classDef;
955 struct PropertyDef * prop;
956 char * string;
957 struct Symbol * symbol;
958 struct PropertyWatch * propertyWatch;
959 struct TemplateParameter * templateParameter;
960 struct TemplateArgument * templateArgument;
961 struct TemplateDatatype * templateDatatype;
962 struct DBTableEntry * dbtableEntry;
963 struct DBIndexItem * dbindexItem;
964 struct DBTableDef * dbtableDef;
965 } __attribute__ ((gcc_struct)) YYSTYPE;
966
967 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
968
969 struct Enumerator
970 {
971 struct Enumerator * prev;
972 struct Enumerator * next;
973 struct Location loc;
974 struct Identifier * id;
975 struct Expression * exp;
976 } __attribute__ ((gcc_struct));
977
978 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
979
980 struct InitDeclarator
981 {
982 struct InitDeclarator * prev;
983 struct InitDeclarator * next;
984 struct Location loc;
985 struct Declarator * declarator;
986 struct Initializer * initializer;
987 } __attribute__ ((gcc_struct));
988
989 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
990
991 struct AsmField
992 {
993 struct AsmField * prev;
994 struct AsmField * next;
995 struct Location loc;
996 char *  command;
997 struct Expression * expression;
998 } __attribute__ ((gcc_struct));
999
1000 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1001
1002 struct Attribute;
1003
1004 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1005
1006 struct ClassFunction
1007 {
1008 struct ClassFunction * prev;
1009 struct ClassFunction * next;
1010 struct Location loc;
1011 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1012 struct Declarator * declarator;
1013 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1014 struct Statement * body;
1015 struct __ecereNameSpace__ecere__com__Class * _class;
1016 struct __ecereNameSpace__ecere__sys__OldList attached;
1017 int declMode;
1018 struct Type * type;
1019 struct Symbol * propSet;
1020 unsigned int isVirtual;
1021 unsigned int isConstructor;
1022 unsigned int isDestructor;
1023 unsigned int dontMangle;
1024 int id;
1025 int idCode;
1026 } __attribute__ ((gcc_struct));
1027
1028 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1029
1030 struct MembersInit
1031 {
1032 struct MembersInit * prev;
1033 struct MembersInit * next;
1034 struct Location loc;
1035 int type;
1036 union
1037 {
1038 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1039 struct ClassFunction * function;
1040 } __attribute__ ((gcc_struct));
1041 } __attribute__ ((gcc_struct));
1042
1043 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1044
1045 struct MemberInit
1046 {
1047 struct MemberInit * prev;
1048 struct MemberInit * next;
1049 struct Location loc;
1050 struct Location realLoc;
1051 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1052 struct Initializer * initializer;
1053 unsigned int used;
1054 unsigned int variable;
1055 unsigned int takeOutExp;
1056 } __attribute__ ((gcc_struct));
1057
1058 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1059
1060 struct PropertyDef
1061 {
1062 struct PropertyDef * prev;
1063 struct PropertyDef * next;
1064 struct Location loc;
1065 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1066 struct Declarator * declarator;
1067 struct Identifier * id;
1068 struct Statement * getStmt;
1069 struct Statement * setStmt;
1070 struct Statement * issetStmt;
1071 struct Symbol * symbol;
1072 unsigned int conversion;
1073 unsigned int isWatchable;
1074 struct Expression * category;
1075 } __attribute__ ((gcc_struct));
1076
1077 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1078
1079 struct PropertyWatch
1080 {
1081 struct PropertyWatch * prev;
1082 struct PropertyWatch * next;
1083 struct Location loc;
1084 struct Statement * compound;
1085 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1086 unsigned int deleteWatch;
1087 } __attribute__ ((gcc_struct));
1088
1089 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1090
1091 struct ClassDef
1092 {
1093 struct ClassDef * prev;
1094 struct ClassDef * next;
1095 struct Location loc;
1096 int type;
1097 union
1098 {
1099 struct Declaration * decl;
1100 struct ClassFunction * function;
1101 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1102 struct PropertyDef * propertyDef;
1103 struct PropertyWatch * propertyWatch;
1104 char *  designer;
1105 struct Identifier * defaultProperty;
1106 struct
1107 {
1108 struct Identifier * id;
1109 struct Initializer * initializer;
1110 } __attribute__ ((gcc_struct));
1111 } __attribute__ ((gcc_struct));
1112 int memberAccess;
1113 void *  object;
1114 } __attribute__ ((gcc_struct));
1115
1116 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1117
1118 struct DBTableEntry;
1119
1120 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1121
1122 struct DBIndexItem;
1123
1124 extern YYSTYPE yylval;
1125
1126 extern struct Location yylloc;
1127
1128 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1129
1130 extern int returnCode;
1131
1132 extern struct Expression * parsedExpression;
1133
1134 extern unsigned int yydebug;
1135
1136 void SetYydebug(unsigned int b)
1137 {
1138 yydebug = b;
1139 }
1140
1141 extern unsigned int echoOn;
1142
1143 void resetScanner();
1144
1145 int propWatcherID;
1146
1147 int expression_yyparse();
1148
1149 static struct Statement * curCompound;
1150
1151 struct External * curExternal, * afterExternal;
1152
1153 static struct Type * curSwitchType;
1154
1155 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1156
1157 struct __ecereNameSpace__ecere__com__Class * thisClass;
1158
1159 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1160 {
1161 thisClass = c;
1162 }
1163
1164 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1165 {
1166 return thisClass;
1167 }
1168
1169 static char * thisNameSpace;
1170
1171 struct __ecereNameSpace__ecere__com__Class * containerClass;
1172
1173 unsigned int thisClassParams = 0x1;
1174
1175 unsigned int internalValueCounter;
1176
1177 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1178
1179 struct __ecereNameSpace__ecere__sys__TempFile
1180 {
1181 char __ecere_padding[24];
1182 } __attribute__ ((gcc_struct));
1183
1184 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1185
1186 extern int strlen(const char * );
1187
1188 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1189
1190 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1191
1192 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1193
1194 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1195
1196 void PrintExpression(struct Expression * exp, char * string)
1197 {
1198 {
1199 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1200 int count;
1201
1202 if(exp)
1203 OutputExpression(exp, f);
1204 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1205 count = strlen(string);
1206 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);
1207 string[count] = '\0';
1208 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1209 }
1210 }
1211
1212 extern int isspace(int c);
1213
1214 long long _strtoi64(char * string, char ** endString, int base)
1215 {
1216 long long value = 0;
1217 int sign = 1;
1218 int c;
1219 char ch;
1220
1221 for(c = 0; (ch = string[c]) && isspace(ch); c++)
1222 ;
1223 if(ch == '+')
1224 c++;
1225 else if(ch == '-')
1226 {
1227 sign = -1;
1228 c++;
1229 }
1230 ;
1231 if(!base)
1232 {
1233 if(ch == (char)0 && string[c + 1] == 'x')
1234 {
1235 base = 16;
1236 c += 2;
1237 }
1238 else if(ch == '0')
1239 {
1240 base = 8;
1241 c++;
1242 }
1243 else
1244 base = 10;
1245 }
1246 for(; (ch = string[c]); c++)
1247 {
1248 if(ch == '0')
1249 ch = (char)0;
1250 else if(ch >= '1' && ch <= '9')
1251 ch -= '1';
1252 else if(ch >= 'a' && ch <= 'z')
1253 ch -= 'a';
1254 else if(ch >= 'A' && ch <= 'Z')
1255 ch -= 'A';
1256 else
1257 {
1258 if(endString)
1259 *endString = string + c;
1260 break;
1261 }
1262 if(ch < base)
1263 {
1264 value *= base;
1265 value += ch;
1266 }
1267 else
1268 {
1269 if(endString)
1270 *endString = string + c;
1271 break;
1272 }
1273 }
1274 return sign * value;
1275 }
1276
1277 uint64 _strtoui64(char * string, char ** endString, int base)
1278 {
1279 uint64 value = 0;
1280 int sign = 1;
1281 int c;
1282 char ch;
1283
1284 for(c = 0; (ch = string[c]) && isspace(ch); c++)
1285 ;
1286 if(ch == '+')
1287 c++;
1288 else if(ch == '-')
1289 {
1290 sign = -1;
1291 c++;
1292 }
1293 ;
1294 if(!base)
1295 {
1296 if(ch == (char)0 && string[c + 1] == 'x')
1297 {
1298 base = 16;
1299 c += 2;
1300 }
1301 else if(ch == '0')
1302 {
1303 base = 8;
1304 c++;
1305 }
1306 else
1307 base = 10;
1308 }
1309 for(; (ch = string[c]); c++)
1310 {
1311 if(ch == '0')
1312 ch = (char)0;
1313 else if(ch >= '1' && ch <= '9')
1314 ch -= '1';
1315 else if(ch >= 'a' && ch <= 'z')
1316 ch -= 'a';
1317 else if(ch >= 'A' && ch <= 'Z')
1318 ch -= 'A';
1319 else
1320 {
1321 if(endString)
1322 *endString = string + c;
1323 break;
1324 }
1325 if(ch < base)
1326 {
1327 value *= base;
1328 value += ch;
1329 }
1330 else
1331 {
1332 if(endString)
1333 *endString = string + c;
1334 break;
1335 }
1336 }
1337 return sign * value;
1338 }
1339
1340 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1341
1342 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1343
1344 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1345 {
1346 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1347 {
1348 if(!param->baseType)
1349 {
1350 if(param->dataTypeString)
1351 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1352 else
1353 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1354 }
1355 return param->baseType;
1356 }
1357 return (((void *)0));
1358 }
1359
1360 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1361 {
1362 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1363 return 0x1;
1364 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1365 {
1366 return 0x0;
1367 }
1368 if(type1->kind == type2->kind)
1369 {
1370 switch(type1->kind)
1371 {
1372 case 1:
1373 case 2:
1374 case 3:
1375 case 4:
1376 if(type1->passAsTemplate && !type2->passAsTemplate)
1377 return 0x1;
1378 return type1->isSigned != type2->isSigned;
1379 case 8:
1380 return type1->_class != type2->_class;
1381 case 13:
1382 return NeedCast(type1->type, type2->type);
1383 default:
1384 return 0x1;
1385 }
1386 }
1387 return 0x1;
1388 }
1389
1390 extern int strcmp(const char * , const char * );
1391
1392 extern struct Context * curContext;
1393
1394 extern struct Context * topContext;
1395
1396 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1397
1398 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);
1399
1400 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1401
1402 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);
1403
1404 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);
1405
1406 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1407
1408 struct __ecereNameSpace__ecere__com__ClassProperty
1409 {
1410 char *  name;
1411 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1412 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1413 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1414 int depth;
1415 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, int);
1416 int (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1417 char *  dataTypeString;
1418 struct Type * dataType;
1419 unsigned int constant;
1420 } __attribute__ ((gcc_struct));
1421
1422 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1423
1424 extern struct Expression * QMkExpId(char *  id);
1425
1426 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1427
1428 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1429 {
1430 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1431 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1432 char *  name;
1433 int type;
1434 union
1435 {
1436 char *  dataTypeString;
1437 int memberType;
1438 } __attribute__ ((gcc_struct));
1439 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1440 void *  param;
1441 char __ecere_padding[4];
1442 } __attribute__ ((gcc_struct));
1443
1444 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1445
1446 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1447
1448 extern void FreeIdentifier(struct Identifier * id);
1449
1450 void ProcessExpressionType(struct Expression * exp);
1451
1452 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1453
1454 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1455
1456 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1457
1458 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1459
1460 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1461
1462 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1463
1464 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1465
1466 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1467
1468 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1469 {
1470 if(exp->type == 0 && exp->identifier)
1471 {
1472 struct Identifier * id = exp->identifier;
1473 struct Context * ctx;
1474 struct Symbol * symbol = (((void *)0));
1475
1476 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1477 {
1478 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1479 {
1480 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1481 if(symbol)
1482 break;
1483 }
1484 }
1485 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1486 {
1487 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1488 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1489 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1490 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1491
1492 if(!prop)
1493 {
1494 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1495 }
1496 if(!prop && !method)
1497 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1498 if(!prop && !method && !member)
1499 {
1500 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1501 }
1502 if(prop || method || member || classProp)
1503 {
1504 exp->type = 8;
1505 exp->member.member = id;
1506 exp->member.memberType = 0;
1507 exp->member.exp = QMkExpId("this");
1508 exp->addedThis = 0x1;
1509 }
1510 else if(_class && _class->templateParams.first)
1511 {
1512 struct __ecereNameSpace__ecere__com__Class * sClass;
1513
1514 for(sClass = _class; sClass; sClass = sClass->base)
1515 {
1516 if(sClass->templateParams.first)
1517 {
1518 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1519
1520 for(param = sClass->templateParams.first; param; param = param->next)
1521 {
1522 if(param->type == 2 && !strcmp(param->name, id->string))
1523 {
1524 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1525
1526 if(argExp)
1527 {
1528 struct Declarator * decl;
1529 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1530
1531 FreeIdentifier(exp->member.member);
1532 ProcessExpressionType(argExp);
1533 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1534 exp->expType = ProcessType(specs, decl);
1535 exp->type = 5;
1536 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1537 }
1538 }
1539 }
1540 }
1541 }
1542 }
1543 }
1544 }
1545 }
1546
1547 extern int sprintf(char * , char * , ...);
1548
1549 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1550
1551 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1552
1553 char * PrintInt(long long result)
1554 {
1555 char temp[100];
1556
1557 if(result > (((long long)0x7fffffffffffffffLL)))
1558 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1559 else
1560 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1561 return __ecereNameSpace__ecere__sys__CopyString(temp);
1562 }
1563
1564 char * PrintUInt(uint64 result)
1565 {
1566 char temp[100];
1567
1568 if(result > (0xffffffff))
1569 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1570 else if(result > (((int)0x7fffffff)))
1571 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1572 else
1573 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1574 return __ecereNameSpace__ecere__sys__CopyString(temp);
1575 }
1576
1577 char * PrintInt64(long long result)
1578 {
1579 char temp[100];
1580
1581 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1582 return __ecereNameSpace__ecere__sys__CopyString(temp);
1583 }
1584
1585 char * PrintUInt64(uint64 result)
1586 {
1587 char temp[100];
1588
1589 if(result > (((long long)0x7fffffffffffffffLL)))
1590 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1591 else
1592 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1593 return __ecereNameSpace__ecere__sys__CopyString(temp);
1594 }
1595
1596 char * PrintHexUInt(uint64 result)
1597 {
1598 char temp[100];
1599
1600 if(result > (0xffffffff))
1601 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1602 else
1603 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1604 return __ecereNameSpace__ecere__sys__CopyString(temp);
1605 }
1606
1607 char * PrintHexUInt64(uint64 result)
1608 {
1609 char temp[100];
1610
1611 if(result > (0xffffffff))
1612 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1613 else
1614 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1615 return __ecereNameSpace__ecere__sys__CopyString(temp);
1616 }
1617
1618 char * PrintShort(short result)
1619 {
1620 char temp[100];
1621
1622 sprintf(temp, "%d", (unsigned short)result);
1623 return __ecereNameSpace__ecere__sys__CopyString(temp);
1624 }
1625
1626 char * PrintUShort(unsigned short result)
1627 {
1628 char temp[100];
1629
1630 if(result > (unsigned short)32767)
1631 sprintf(temp, "0x%X", (int)result);
1632 else
1633 sprintf(temp, "%d", result);
1634 return __ecereNameSpace__ecere__sys__CopyString(temp);
1635 }
1636
1637 extern int isprint(int c);
1638
1639 char * PrintChar(char result)
1640 {
1641 char temp[100];
1642
1643 if(result > (char)0 && isprint(result))
1644 sprintf(temp, "'%c'", result);
1645 else if(result < (char)0)
1646 sprintf(temp, "%d", result);
1647 else
1648 sprintf(temp, "0x%X", (unsigned char)result);
1649 return __ecereNameSpace__ecere__sys__CopyString(temp);
1650 }
1651
1652 char * PrintUChar(unsigned char result)
1653 {
1654 char temp[100];
1655
1656 sprintf(temp, "0x%X", result);
1657 return __ecereNameSpace__ecere__sys__CopyString(temp);
1658 }
1659
1660 char * PrintFloat(float result)
1661 {
1662 char temp[350];
1663
1664 sprintf(temp, "%.16ff", result);
1665 return __ecereNameSpace__ecere__sys__CopyString(temp);
1666 }
1667
1668 char * PrintDouble(double result)
1669 {
1670 char temp[350];
1671
1672 sprintf(temp, "%.16f", result);
1673 return __ecereNameSpace__ecere__sys__CopyString(temp);
1674 }
1675
1676 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1677
1678 struct OpTable
1679 {
1680 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1681 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1682 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1683 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1684 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1685 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1686 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1687 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1688 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1689 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1690 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1691 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1692 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1693 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1694 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1695 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1696 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1697 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1698 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1699 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1700 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1701 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1702 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1703 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1704 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1705 unsigned int (*  Not)(struct Expression *, struct Operand *);
1706 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1707 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1708 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1709 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1710 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1711 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1712 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1713 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1714 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1715 } __attribute__ ((gcc_struct));
1716
1717 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1718
1719 struct Operand
1720 {
1721 int kind;
1722 struct Type * type;
1723 unsigned int ptrSize;
1724 union
1725 {
1726 char c;
1727 unsigned char uc;
1728 short s;
1729 unsigned short us;
1730 int i;
1731 unsigned int ui;
1732 float f;
1733 double d;
1734 unsigned char *  p;
1735 long long i64;
1736 uint64 ui64;
1737 } __attribute__ ((gcc_struct));
1738 struct OpTable ops;
1739 } __attribute__ ((gcc_struct));
1740
1741 struct Operand GetOperand(struct Expression * exp);
1742
1743 unsigned int GetInt(struct Expression * exp, int * value2)
1744 {
1745 struct Operand op2 = GetOperand(exp);
1746
1747 if(op2.kind == 3 && op2.type->isSigned)
1748 *value2 = op2.i;
1749 else if(op2.kind == 3)
1750 *value2 = (int)op2.ui;
1751 if(op2.kind == 4 && op2.type->isSigned)
1752 *value2 = (int)op2.i64;
1753 else if(op2.kind == 4)
1754 *value2 = (int)op2.ui64;
1755 else if(op2.kind == 2 && op2.type->isSigned)
1756 *value2 = (int)op2.s;
1757 else if(op2.kind == 2)
1758 *value2 = (int)op2.us;
1759 else if(op2.kind == 1 && op2.type->isSigned)
1760 *value2 = (int)op2.c;
1761 else if(op2.kind == 1)
1762 *value2 = (int)op2.uc;
1763 else if(op2.kind == 6)
1764 *value2 = (int)op2.f;
1765 else if(op2.kind == 7)
1766 *value2 = (int)op2.d;
1767 else if(op2.kind == 13)
1768 *value2 = (int)op2.ui;
1769 else
1770 return 0x0;
1771 return 0x1;
1772 }
1773
1774 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1775 {
1776 struct Operand op2 = GetOperand(exp);
1777
1778 if(op2.kind == 3 && op2.type->isSigned)
1779 *value2 = (unsigned int)op2.i;
1780 else if(op2.kind == 3)
1781 *value2 = op2.ui;
1782 if(op2.kind == 4 && op2.type->isSigned)
1783 *value2 = (unsigned int)op2.i64;
1784 else if(op2.kind == 4)
1785 *value2 = (unsigned int)op2.ui64;
1786 else if(op2.kind == 2 && op2.type->isSigned)
1787 *value2 = (unsigned int)op2.s;
1788 else if(op2.kind == 2)
1789 *value2 = (unsigned int)op2.us;
1790 else if(op2.kind == 1 && op2.type->isSigned)
1791 *value2 = (unsigned int)op2.c;
1792 else if(op2.kind == 1)
1793 *value2 = (unsigned int)op2.uc;
1794 else if(op2.kind == 6)
1795 *value2 = (unsigned int)op2.f;
1796 else if(op2.kind == 7)
1797 *value2 = (unsigned int)op2.d;
1798 else if(op2.kind == 13)
1799 *value2 = op2.ui;
1800 else
1801 return 0x0;
1802 return 0x1;
1803 }
1804
1805 unsigned int GetInt64(struct Expression * exp, long long * value2)
1806 {
1807 struct Operand op2 = GetOperand(exp);
1808
1809 if(op2.kind == 3 && op2.type->isSigned)
1810 *value2 = (long long)op2.i;
1811 else if(op2.kind == 3)
1812 *value2 = (long long)op2.ui;
1813 if(op2.kind == 4 && op2.type->isSigned)
1814 *value2 = op2.i64;
1815 else if(op2.kind == 4)
1816 *value2 = (long long)op2.ui64;
1817 else if(op2.kind == 2 && op2.type->isSigned)
1818 *value2 = (long long)op2.s;
1819 else if(op2.kind == 2)
1820 *value2 = (long long)op2.us;
1821 else if(op2.kind == 1 && op2.type->isSigned)
1822 *value2 = (long long)op2.c;
1823 else if(op2.kind == 1)
1824 *value2 = (long long)op2.uc;
1825 else if(op2.kind == 6)
1826 *value2 = (long long)op2.f;
1827 else if(op2.kind == 7)
1828 *value2 = (long long)op2.d;
1829 else if(op2.kind == 13)
1830 *value2 = (long long)op2.ui;
1831 else
1832 return 0x0;
1833 return 0x1;
1834 }
1835
1836 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1837 {
1838 struct Operand op2 = GetOperand(exp);
1839
1840 if(op2.kind == 3 && op2.type->isSigned)
1841 *value2 = (uint64)op2.i;
1842 else if(op2.kind == 3)
1843 *value2 = (uint64)op2.ui;
1844 if(op2.kind == 4 && op2.type->isSigned)
1845 *value2 = (uint64)op2.i64;
1846 else if(op2.kind == 4)
1847 *value2 = op2.ui64;
1848 else if(op2.kind == 2 && op2.type->isSigned)
1849 *value2 = (uint64)op2.s;
1850 else if(op2.kind == 2)
1851 *value2 = (uint64)op2.us;
1852 else if(op2.kind == 1 && op2.type->isSigned)
1853 *value2 = (uint64)op2.c;
1854 else if(op2.kind == 1)
1855 *value2 = (uint64)op2.uc;
1856 else if(op2.kind == 6)
1857 *value2 = (uint64)op2.f;
1858 else if(op2.kind == 7)
1859 *value2 = (uint64)op2.d;
1860 else if(op2.kind == 13)
1861 *value2 = (uint64)op2.ui;
1862 else
1863 return 0x0;
1864 return 0x1;
1865 }
1866
1867 unsigned int GetShort(struct Expression * exp, short * value2)
1868 {
1869 struct Operand op2 = GetOperand(exp);
1870
1871 if(op2.kind == 3 && op2.type->isSigned)
1872 *value2 = (short)op2.i;
1873 else if(op2.kind == 3)
1874 *value2 = (short)op2.ui;
1875 if(op2.kind == 4 && op2.type->isSigned)
1876 *value2 = (short)op2.i64;
1877 else if(op2.kind == 4)
1878 *value2 = (short)op2.ui64;
1879 else if(op2.kind == 2 && op2.type->isSigned)
1880 *value2 = op2.s;
1881 else if(op2.kind == 2)
1882 *value2 = (short)op2.us;
1883 else if(op2.kind == 1 && op2.type->isSigned)
1884 *value2 = (short)op2.c;
1885 else if(op2.kind == 1)
1886 *value2 = (short)op2.uc;
1887 else if(op2.kind == 6)
1888 *value2 = (short)op2.f;
1889 else if(op2.kind == 7)
1890 *value2 = (short)op2.d;
1891 else if(op2.kind == 13)
1892 *value2 = (short)op2.ui;
1893 else
1894 return 0x0;
1895 return 0x1;
1896 }
1897
1898 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
1899 {
1900 struct Operand op2 = GetOperand(exp);
1901
1902 if(op2.kind == 3 && op2.type->isSigned)
1903 *value2 = (unsigned short)op2.i;
1904 else if(op2.kind == 3)
1905 *value2 = (unsigned short)op2.ui;
1906 if(op2.kind == 4 && op2.type->isSigned)
1907 *value2 = (unsigned short)op2.i64;
1908 else if(op2.kind == 4)
1909 *value2 = (unsigned short)op2.ui64;
1910 else if(op2.kind == 2 && op2.type->isSigned)
1911 *value2 = (unsigned short)op2.s;
1912 else if(op2.kind == 2)
1913 *value2 = op2.us;
1914 else if(op2.kind == 1 && op2.type->isSigned)
1915 *value2 = (unsigned short)op2.c;
1916 else if(op2.kind == 1)
1917 *value2 = (unsigned short)op2.uc;
1918 else if(op2.kind == 6)
1919 *value2 = (unsigned short)op2.f;
1920 else if(op2.kind == 7)
1921 *value2 = (unsigned short)op2.d;
1922 else if(op2.kind == 13)
1923 *value2 = (unsigned short)op2.ui;
1924 else
1925 return 0x0;
1926 return 0x1;
1927 }
1928
1929 unsigned int GetChar(struct Expression * exp, char * value2)
1930 {
1931 struct Operand op2 = GetOperand(exp);
1932
1933 if(op2.kind == 3 && op2.type->isSigned)
1934 *value2 = (char)op2.i;
1935 else if(op2.kind == 3)
1936 *value2 = (char)op2.ui;
1937 if(op2.kind == 4 && op2.type->isSigned)
1938 *value2 = (char)op2.i64;
1939 else if(op2.kind == 4)
1940 *value2 = (char)op2.ui64;
1941 else if(op2.kind == 2 && op2.type->isSigned)
1942 *value2 = (char)op2.s;
1943 else if(op2.kind == 2)
1944 *value2 = (char)op2.us;
1945 else if(op2.kind == 1 && op2.type->isSigned)
1946 *value2 = op2.c;
1947 else if(op2.kind == 1)
1948 *value2 = (char)op2.uc;
1949 else if(op2.kind == 6)
1950 *value2 = (char)op2.f;
1951 else if(op2.kind == 7)
1952 *value2 = (char)op2.d;
1953 else if(op2.kind == 13)
1954 *value2 = (char)op2.ui;
1955 else
1956 return 0x0;
1957 return 0x1;
1958 }
1959
1960 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
1961 {
1962 struct Operand op2 = GetOperand(exp);
1963
1964 if(op2.kind == 3 && op2.type->isSigned)
1965 *value2 = (unsigned char)op2.i;
1966 else if(op2.kind == 3)
1967 *value2 = (unsigned char)op2.ui;
1968 if(op2.kind == 4 && op2.type->isSigned)
1969 *value2 = (unsigned char)op2.i64;
1970 else if(op2.kind == 4)
1971 *value2 = (unsigned char)op2.ui64;
1972 else if(op2.kind == 2 && op2.type->isSigned)
1973 *value2 = (unsigned char)op2.s;
1974 else if(op2.kind == 2)
1975 *value2 = (unsigned char)op2.us;
1976 else if(op2.kind == 1 && op2.type->isSigned)
1977 *value2 = (unsigned char)op2.c;
1978 else if(op2.kind == 1)
1979 *value2 = op2.uc;
1980 else if(op2.kind == 6)
1981 *value2 = (unsigned char)op2.f;
1982 else if(op2.kind == 7)
1983 *value2 = (unsigned char)op2.d;
1984 else if(op2.kind == 13)
1985 *value2 = (unsigned char)op2.ui;
1986 else
1987 return 0x0;
1988 return 0x1;
1989 }
1990
1991 unsigned int GetFloat(struct Expression * exp, float * value2)
1992 {
1993 struct Operand op2 = GetOperand(exp);
1994
1995 if(op2.kind == 3 && op2.type->isSigned)
1996 *value2 = (float)(float)op2.i;
1997 else if(op2.kind == 3)
1998 *value2 = (float)(float)op2.ui;
1999 if(op2.kind == 4 && op2.type->isSigned)
2000 *value2 = (float)(float)op2.i64;
2001 else if(op2.kind == 4)
2002 *value2 = (float)(float)op2.ui64;
2003 else if(op2.kind == 2 && op2.type->isSigned)
2004 *value2 = (float)(float)op2.s;
2005 else if(op2.kind == 2)
2006 *value2 = (float)(float)op2.us;
2007 else if(op2.kind == 1 && op2.type->isSigned)
2008 *value2 = (float)(float)op2.c;
2009 else if(op2.kind == 1)
2010 *value2 = (float)(float)op2.uc;
2011 else if(op2.kind == 6)
2012 *value2 = (float)op2.f;
2013 else if(op2.kind == 7)
2014 *value2 = (float)op2.d;
2015 else if(op2.kind == 13)
2016 *value2 = (float)(float)op2.ui;
2017 else
2018 return 0x0;
2019 return 0x1;
2020 }
2021
2022 unsigned int GetDouble(struct Expression * exp, double * value2)
2023 {
2024 struct Operand op2 = GetOperand(exp);
2025
2026 if(op2.kind == 3 && op2.type->isSigned)
2027 *value2 = (double)(double)op2.i;
2028 else if(op2.kind == 3)
2029 *value2 = (double)(double)op2.ui;
2030 if(op2.kind == 4 && op2.type->isSigned)
2031 *value2 = (double)(double)op2.i64;
2032 else if(op2.kind == 4)
2033 *value2 = (double)(double)op2.ui64;
2034 else if(op2.kind == 2 && op2.type->isSigned)
2035 *value2 = (double)(double)op2.s;
2036 else if(op2.kind == 2)
2037 *value2 = (double)(double)op2.us;
2038 else if(op2.kind == 1 && op2.type->isSigned)
2039 *value2 = (double)(double)op2.c;
2040 else if(op2.kind == 1)
2041 *value2 = (double)(double)op2.uc;
2042 else if(op2.kind == 6)
2043 *value2 = (double)op2.f;
2044 else if(op2.kind == 7)
2045 *value2 = (double)op2.d;
2046 else if(op2.kind == 13)
2047 *value2 = (double)(double)op2.ui;
2048 else
2049 return 0x0;
2050 return 0x1;
2051 }
2052
2053 void ComputeExpression(struct Expression * exp);
2054
2055 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2056
2057 int ComputeTypeSize(struct Type * type);
2058
2059 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2060
2061 struct __ecereNameSpace__ecere__com__BitMember
2062 {
2063 struct __ecereNameSpace__ecere__com__BitMember * prev;
2064 struct __ecereNameSpace__ecere__com__BitMember * next;
2065 char *  name;
2066 unsigned int isProperty;
2067 int memberAccess;
2068 int id;
2069 struct __ecereNameSpace__ecere__com__Class * _class;
2070 char *  dataTypeString;
2071 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2072 struct Type * dataType;
2073 int type;
2074 int size;
2075 int pos;
2076 uint64 mask;
2077 } __attribute__ ((gcc_struct));
2078
2079 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2080
2081 struct __ecereNameSpace__ecere__sys__OldLink
2082 {
2083 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2084 struct __ecereNameSpace__ecere__sys__OldLink * next;
2085 void *  data;
2086 } __attribute__ ((gcc_struct));
2087
2088 void FinishTemplatesContext(struct Context * context);
2089
2090 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2091 {
2092 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2093 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2094
2095 if(member || ((_class->type == 2 || _class->type == 0 || _class->type == 1 || _class->type == 5) && (_class->type == 2 || _class->structSize == _class->offset) && _class->computeSize))
2096 {
2097 int c;
2098 int unionMemberOffset = 0;
2099 int bitFields = 0;
2100
2101 if(!member && _class->destructionWatchOffset)
2102 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2103 {
2104 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2105
2106 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2107 {
2108 if(!dataMember->isProperty)
2109 {
2110 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2111 {
2112 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2113 }
2114 }
2115 }
2116 }
2117 {
2118 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2119
2120 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2121 {
2122 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2123 {
2124 if(!isMember && _class->type == 2 && dataMember->dataType)
2125 {
2126 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2127 uint64 mask = 0;
2128 int d;
2129
2130 ComputeTypeSize(dataMember->dataType);
2131 if(bitMember->pos == -1)
2132 bitMember->pos = _class->memberOffset;
2133 if(!bitMember->size)
2134 bitMember->size = dataMember->dataType->size * 8;
2135 _class->memberOffset = bitMember->pos + bitMember->size;
2136 for(d = 0; d < bitMember->size; d++)
2137 {
2138 if(d)
2139 mask <<= 1;
2140 mask |= 1;
2141 }
2142 bitMember->mask = mask << bitMember->pos;
2143 }
2144 else if(dataMember->type == 0 && dataMember->dataType)
2145 {
2146 int size;
2147 int alignment = 0;
2148
2149 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2150 ComputeTypeSize(dataMember->dataType);
2151 if(dataMember->dataType->bitFieldCount)
2152 {
2153 bitFields += dataMember->dataType->bitFieldCount;
2154 size = 0;
2155 }
2156 else
2157 {
2158 if(bitFields)
2159 {
2160 int size = (bitFields + 7) / 8;
2161
2162 if(isMember)
2163 {
2164 int __simpleStruct0;
2165
2166 if(alignment)
2167 {
2168 int __simpleStruct0;
2169
2170 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2171 if(member->memberOffset % alignment)
2172 member->memberOffset += alignment - (member->memberOffset % alignment);
2173 }
2174 dataMember->offset = member->memberOffset;
2175 if(member->type == 1)
2176 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2177 else
2178 {
2179 member->memberOffset += size;
2180 }
2181 }
2182 else
2183 {
2184 if(alignment)
2185 {
2186 int __simpleStruct0;
2187
2188 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2189 if(_class->memberOffset % alignment)
2190 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2191 }
2192 dataMember->offset = _class->memberOffset;
2193 _class->memberOffset += size;
2194 }
2195 bitFields = 0;
2196 }
2197 size = dataMember->dataType->size;
2198 alignment = dataMember->dataType->alignment;
2199 }
2200 if(isMember)
2201 {
2202 int __simpleStruct0;
2203
2204 if(alignment)
2205 {
2206 int __simpleStruct0;
2207
2208 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2209 if(member->memberOffset % alignment)
2210 member->memberOffset += alignment - (member->memberOffset % alignment);
2211 }
2212 dataMember->offset = member->memberOffset;
2213 if(member->type == 1)
2214 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2215 else
2216 {
2217 member->memberOffset += size;
2218 }
2219 }
2220 else
2221 {
2222 if(alignment)
2223 {
2224 int __simpleStruct0;
2225
2226 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2227 if(_class->memberOffset % alignment)
2228 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2229 }
2230 dataMember->offset = _class->memberOffset;
2231 _class->memberOffset += size;
2232 }
2233 }
2234 else
2235 {
2236 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2237 if(isMember)
2238 {
2239 int __simpleStruct2;
2240 int __simpleStruct0, __simpleStruct1;
2241
2242 member->structAlignment = (__simpleStruct0 = member->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2243 dataMember->offset = member->memberOffset;
2244 if(member->type == 1)
2245 unionMemberOffset = (__simpleStruct2 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct2) ? unionMemberOffset : __simpleStruct2);
2246 else
2247 member->memberOffset += dataMember->memberOffset;
2248 }
2249 else
2250 {
2251 int __simpleStruct0, __simpleStruct1;
2252
2253 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2254 dataMember->offset = _class->memberOffset;
2255 _class->memberOffset += dataMember->memberOffset;
2256 }
2257 }
2258 }
2259 }
2260 if(bitFields)
2261 {
2262 int alignment = 0;
2263 int size = (bitFields + 7) / 8;
2264
2265 if(isMember)
2266 {
2267 int __simpleStruct0;
2268
2269 if(alignment)
2270 {
2271 int __simpleStruct0;
2272
2273 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2274 if(member->memberOffset % alignment)
2275 member->memberOffset += alignment - (member->memberOffset % alignment);
2276 }
2277 if(member->type == 1)
2278 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2279 else
2280 {
2281 member->memberOffset += size;
2282 }
2283 }
2284 else
2285 {
2286 if(alignment)
2287 {
2288 int __simpleStruct0;
2289
2290 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2291 if(_class->memberOffset % alignment)
2292 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2293 }
2294 _class->memberOffset += size;
2295 }
2296 bitFields = 0;
2297 }
2298 }
2299 if(member && member->type == 1)
2300 {
2301 member->memberOffset = unionMemberOffset;
2302 }
2303 if(!isMember)
2304 {
2305 if(_class->type != 2)
2306 {
2307 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset;
2308 if(!member)
2309 {
2310 struct __ecereNameSpace__ecere__com__Property * prop;
2311
2312 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2313 {
2314 if(prop->isProperty && prop->isWatchable)
2315 {
2316 prop->watcherOffset = _class->structSize;
2317 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2318 }
2319 }
2320 }
2321 {
2322 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2323
2324 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2325 {
2326 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2327
2328 if(deriv->computeSize)
2329 {
2330 deriv->offset = _class->structSize;
2331 deriv->memberOffset = 0;
2332 deriv->structSize = deriv->offset;
2333 ComputeClassMembers(deriv, 0x0);
2334 }
2335 }
2336 }
2337 }
2338 }
2339 }
2340 if(context)
2341 FinishTemplatesContext(context);
2342 }
2343
2344 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2345
2346 struct __ecereNameSpace__ecere__com__NameSpace
2347 {
2348 char *  name;
2349 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2350 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2351 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2352 int depth;
2353 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2354 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2355 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2356 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2357 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2358 } __attribute__ ((gcc_struct));
2359
2360 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2361
2362 struct __ecereNameSpace__ecere__com__Module
2363 {
2364 struct __ecereNameSpace__ecere__com__Instance * application;
2365 struct __ecereNameSpace__ecere__sys__OldList classes;
2366 struct __ecereNameSpace__ecere__sys__OldList defines;
2367 struct __ecereNameSpace__ecere__sys__OldList functions;
2368 struct __ecereNameSpace__ecere__sys__OldList modules;
2369 struct __ecereNameSpace__ecere__com__Instance * prev;
2370 struct __ecereNameSpace__ecere__com__Instance * next;
2371 char *  name;
2372 void *  library;
2373 void *  Unload;
2374 int importType;
2375 int origImportType;
2376 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2377 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2378 } __attribute__ ((gcc_struct));
2379
2380 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2381 {
2382 struct __ecereNameSpace__ecere__com__Class * _class;
2383 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2384
2385 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->modules.first; subModule; subModule = subModule->next)
2386 ComputeModuleClasses(subModule->data);
2387 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->classes.first; _class; _class = _class->next)
2388 ComputeClassMembers(_class, 0x0);
2389 }
2390
2391 extern unsigned int inCompiler;
2392
2393 extern void Compiler_Error(char *  format, ...);
2394
2395 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2396
2397 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2398
2399 extern int __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
2400
2401 int ComputeTypeSize(struct Type * type)
2402 {
2403 unsigned int size = type ? type->size : 0;
2404
2405 if(!size && type && !type->computing)
2406 {
2407 type->computing = 0x1;
2408 switch(type->kind)
2409 {
2410 case 1:
2411 type->alignment = size = sizeof(char);
2412 break;
2413 case 3:
2414 type->alignment = size = sizeof(int);
2415 break;
2416 case 4:
2417 type->alignment = size = sizeof(long long);
2418 break;
2419 case 5:
2420 type->alignment = size = sizeof(long);
2421 break;
2422 case 2:
2423 type->alignment = size = sizeof(short);
2424 break;
2425 case 6:
2426 type->alignment = size = sizeof(float);
2427 break;
2428 case 7:
2429 type->alignment = size = sizeof(double);
2430 break;
2431 case 8:
2432 {
2433 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2434
2435 if(_class && _class->type == 1)
2436 {
2437 ComputeClassMembers(_class, 0x0);
2438 type->alignment = _class->structAlignment;
2439 size = _class->structSize;
2440 if(type->alignment && size % type->alignment)
2441 size += type->alignment - (size % type->alignment);
2442 }
2443 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2444 {
2445 if(!_class->dataType)
2446 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2447 size = type->alignment = ComputeTypeSize(_class->dataType);
2448 }
2449 else
2450 size = type->alignment = sizeof(struct __ecereNameSpace__ecere__com__Instance **);
2451 break;
2452 }
2453 case 13:
2454 case 19:
2455 size = type->alignment = sizeof(void *);
2456 break;
2457 case 12:
2458 if(type->arraySizeExp)
2459 {
2460 ProcessExpressionType(type->arraySizeExp);
2461 ComputeExpression(type->arraySizeExp);
2462 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)))
2463 {
2464 struct Location oldLoc = yylloc;
2465 char expression[10240];
2466
2467 expression[0] = '\0';
2468 type->arraySizeExp->expType = (((void *)0));
2469 yylloc = type->arraySizeExp->loc;
2470 if(inCompiler)
2471 PrintExpression(type->arraySizeExp, expression);
2472 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2473 yylloc = oldLoc;
2474 }
2475 GetInt(type->arraySizeExp, &type->arraySize);
2476 }
2477 else if(type->enumClass)
2478 {
2479 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2480 {
2481 type->arraySize = __ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2482 }
2483 else
2484 type->arraySize = 0;
2485 }
2486 else
2487 {
2488 type->arraySize = 0;
2489 }
2490 size = ComputeTypeSize(type->type) * type->arraySize;
2491 type->alignment = type->type->alignment;
2492 break;
2493 case 9:
2494 {
2495 struct Type * member;
2496
2497 for(member = type->members.first; member; member = member->next)
2498 {
2499 int __simpleStruct0, __simpleStruct1;
2500 unsigned int addSize = ComputeTypeSize(member);
2501
2502 member->offset = size;
2503 if(member->alignment && size % member->alignment)
2504 member->offset += member->alignment - (size % member->alignment);
2505 size = member->offset;
2506 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2507 size += addSize;
2508 }
2509 if(type->alignment && size % type->alignment)
2510 size += type->alignment - (size % type->alignment);
2511 break;
2512 }
2513 case 10:
2514 {
2515 struct Type * member;
2516
2517 for(member = type->members.first; member; member = member->next)
2518 {
2519 int __simpleStruct0, __simpleStruct1;
2520 unsigned int addSize = ComputeTypeSize(member);
2521
2522 member->offset = size;
2523 if(member->alignment && size % member->alignment)
2524 member->offset += member->alignment - (size % member->alignment);
2525 size = member->offset;
2526 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2527 size = ((size > addSize) ? size : addSize);
2528 }
2529 if(type->alignment && size % type->alignment)
2530 size += type->alignment - (size % type->alignment);
2531 break;
2532 }
2533 case 20:
2534 {
2535 struct TemplateParameter * param = type->templateParameter;
2536 struct Type * baseType = ProcessTemplateParameterType(param);
2537
2538 if(baseType)
2539 size = ComputeTypeSize(baseType);
2540 else
2541 size = sizeof(uint64);
2542 break;
2543 }
2544 case 15:
2545 {
2546 size = sizeof(enum
2547 {
2548 test
2549 });
2550 break;
2551 }
2552 case 21:
2553 {
2554 size = sizeof(void *);
2555 break;
2556 }
2557 }
2558 type->size = size;
2559 type->computing = 0x0;
2560 }
2561 return size;
2562 }
2563
2564 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2565
2566 extern struct Identifier * MkIdentifier(char *  string);
2567
2568 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2569
2570 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2571
2572 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2573
2574 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2575
2576 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2577
2578 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2579
2580 extern void FreeType(struct Type * type);
2581
2582 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2583
2584 extern struct Specifier * MkSpecifier(int specifier);
2585
2586 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2587
2588 extern struct Expression * MkExpConstant(char *  string);
2589
2590 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)
2591 {
2592 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2593 unsigned int totalSize = 0;
2594 unsigned int maxSize = 0;
2595 int alignment, size;
2596 struct __ecereNameSpace__ecere__com__DataMember * member;
2597 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2598
2599 if(!isMember && _class->base)
2600 {
2601 maxSize = _class->structSize;
2602 {
2603 if(_class->type == 1 || _class->type == 5)
2604 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass);
2605 else
2606 maxSize -= _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2607 }
2608 }
2609 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2610 {
2611 if(!member->isProperty)
2612 {
2613 switch(member->type)
2614 {
2615 case 0:
2616 {
2617 if(member->dataTypeString)
2618 {
2619 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2620 struct Declarator * decl;
2621
2622 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2623 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2624 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2625 if(!member->dataType)
2626 member->dataType = ProcessType(specs, decl);
2627 ReplaceThisClassSpecifiers(specs, topClass);
2628 {
2629 struct Type * type = ProcessType(specs, decl);
2630
2631 DeclareType(member->dataType, 0x0, 0x0);
2632 FreeType(type);
2633 }
2634 ComputeTypeSize(member->dataType);
2635 size = member->dataType->size;
2636 alignment = member->dataType->alignment;
2637 if(alignment)
2638 {
2639 if(totalSize % alignment)
2640 totalSize += alignment - (totalSize % alignment);
2641 }
2642 totalSize += size;
2643 }
2644 break;
2645 }
2646 case 1:
2647 case 2:
2648 {
2649 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2650
2651 size = 0;
2652 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass);
2653 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2654 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2655 alignment = member->structAlignment;
2656 if(alignment)
2657 {
2658 if(totalSize % alignment)
2659 totalSize += alignment - (totalSize % alignment);
2660 }
2661 totalSize += size;
2662 break;
2663 }
2664 }
2665 }
2666 }
2667 if(retSize)
2668 {
2669 unsigned int __simpleStruct0;
2670
2671 if(topMember && topMember->type == 1)
2672 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2673 else
2674 *retSize += totalSize;
2675 }
2676 else if(totalSize < maxSize && _class->type != 1000)
2677 {
2678 char sizeString[50];
2679
2680 sprintf(sizeString, "%d", maxSize - totalSize);
2681 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2682 }
2683 if(context)
2684 FinishTemplatesContext(context);
2685 return topMember ? topMember->memberID : _class->memberID;
2686 }
2687
2688 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2689 {
2690 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2691 unsigned int totalSize = 0;
2692 struct __ecereNameSpace__ecere__com__DataMember * member;
2693 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2694
2695 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2696 DeclareMembers(_class->base, 0x0);
2697 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2698 {
2699 if(!member->isProperty)
2700 {
2701 switch(member->type)
2702 {
2703 case 0:
2704 {
2705 if(!member->dataType && member->dataTypeString)
2706 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2707 if(member->dataType)
2708 DeclareType(member->dataType, 0x0, 0x0);
2709 break;
2710 }
2711 case 1:
2712 case 2:
2713 {
2714 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2715 break;
2716 }
2717 }
2718 }
2719 }
2720 if(context)
2721 FinishTemplatesContext(context);
2722 return topMember ? topMember->memberID : _class->memberID;
2723 }
2724
2725 extern struct Symbol * FindClass(char *  name);
2726
2727 extern char *  strchr(char * , int);
2728
2729 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2730
2731 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (* )(void * ));
2732
2733 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2734
2735 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2736
2737 extern char *  strcpy(char * , const char * );
2738
2739 extern void MangleClassName(char *  className);
2740
2741 extern void DeclareClass(struct Symbol * classSym, char *  className);
2742
2743 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2744
2745 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2746
2747 void DeclareStruct(char * name, unsigned int skipNoHead)
2748 {
2749 struct External * external = (((void *)0));
2750 struct Symbol * classSym = FindClass(name);
2751
2752 if(!inCompiler || !classSym)
2753 return (((void *)0));
2754 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2755 return (((void *)0));
2756 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2757 {
2758 struct Declaration * decl;
2759 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2760 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2761 char structName[1024];
2762
2763 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2764 classSym->declaring++;
2765 if(strchr(classSym->string, '<'))
2766 {
2767 if(classSym->registered->templateClass)
2768 {
2769 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2770 classSym->declaring--;
2771 }
2772 return (((void *)0));
2773 }
2774 DeclareMembers(classSym->registered, 0x0);
2775 structName[0] = (char)0;
2776 FullClassNameCat(structName, name, 0x0);
2777 if(!skipNoHead)
2778 {
2779 classSym->declaredStructSym = 0x1;
2780 declarations = MkList();
2781 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered);
2782 if(!(*declarations).count)
2783 {
2784 FreeList(declarations, (((void *)0)));
2785 declarations = (((void *)0));
2786 }
2787 }
2788 if(skipNoHead || declarations)
2789 {
2790 if(external && external->declaration)
2791 {
2792 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2793 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2794 {
2795 if(classSym->structExternal)
2796 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2797 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2798 classSym->id = curExternal->symbol->idCode;
2799 classSym->idCode = curExternal->symbol->idCode;
2800 }
2801 }
2802 else
2803 {
2804 if(!external)
2805 external = MkExternalDeclaration((((void *)0)));
2806 specifiers = MkList();
2807 declarators = MkList();
2808 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
2809 external->declaration = decl = MkDeclaration(specifiers, declarators);
2810 if(decl->symbol && !decl->symbol->pointerExternal)
2811 decl->symbol->pointerExternal = external;
2812 if(classSym->registered && classSym->registered->type == 1)
2813 {
2814 char className[1024];
2815
2816 strcpy(className, "__ecereClass_");
2817 FullClassNameCat(className, classSym->string, 0x1);
2818 MangleClassName(className);
2819 DeclareClass(classSym, className);
2820 external->symbol = classSym;
2821 classSym->pointerExternal = external;
2822 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2823 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2824 }
2825 else
2826 {
2827 char className[1024];
2828
2829 strcpy(className, "__ecereClass_");
2830 FullClassNameCat(className, classSym->string, 0x1);
2831 MangleClassName(className);
2832 classSym->structExternal = external;
2833 DeclareClass(classSym, className);
2834 external->symbol = classSym;
2835 }
2836 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
2837 }
2838 }
2839 classSym->declaring--;
2840 }
2841 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2842 {
2843 classSym->declaring++;
2844 {
2845 if(classSym->registered)
2846 DeclareMembers(classSym->registered, 0x0);
2847 }
2848 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
2849 {
2850 if(classSym->structExternal)
2851 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2852 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2853 classSym->id = curExternal->symbol->idCode;
2854 classSym->idCode = curExternal->symbol->idCode;
2855 }
2856 classSym->declaring--;
2857 }
2858 }
2859
2860 extern char *  strcat(char * , const char * );
2861
2862 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
2863
2864 extern struct ModuleImport * mainModule;
2865
2866 extern struct Specifier * MkSpecifierName(char *  name);
2867
2868 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
2869
2870 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
2871
2872 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
2873
2874 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
2875
2876 extern void FreeDeclarator(struct Declarator * decl);
2877
2878 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
2879
2880 struct PropertyImport
2881 {
2882 struct PropertyImport * prev;
2883 struct PropertyImport * next;
2884 char *  name;
2885 unsigned int isVirtual;
2886 unsigned int hasSet;
2887 unsigned int hasGet;
2888 } __attribute__ ((gcc_struct));
2889
2890 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
2891
2892 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
2893 {
2894 void * __ecereTemp1;
2895 struct Symbol * symbol = prop->symbol;
2896 char propName[1024];
2897
2898 strcpy(setName, "__ecereProp_");
2899 FullClassNameCat(setName, prop->_class->fullName, 0x0);
2900 strcat(setName, "_Set_");
2901 FullClassNameCat(setName, prop->name, 0x1);
2902 strcpy(getName, "__ecereProp_");
2903 FullClassNameCat(getName, prop->_class->fullName, 0x0);
2904 strcat(getName, "_Get_");
2905 FullClassNameCat(getName, prop->name, 0x1);
2906 strcpy(propName, "__ecereProp_");
2907 FullClassNameCat(propName, prop->_class->fullName, 0x0);
2908 strcat(propName, "_");
2909 FullClassNameCat(propName, prop->name, 0x1);
2910 MangleClassName(getName);
2911 MangleClassName(setName);
2912 MangleClassName(propName);
2913 if(prop->_class->type == 1)
2914 DeclareStruct(prop->_class->fullName, 0x0);
2915 if(!symbol || curExternal->symbol->idCode < symbol->id)
2916 {
2917 unsigned int imported = 0x0;
2918 unsigned int dllImport = 0x0;
2919
2920 if(!symbol || symbol->_import)
2921 {
2922 if(!symbol)
2923 {
2924 struct Symbol * classSym;
2925
2926 if(!prop->_class->symbol)
2927 prop->_class->symbol = FindClass(prop->_class->fullName);
2928 classSym = prop->_class->symbol;
2929 if(classSym && !classSym->_import)
2930 {
2931 struct ModuleImport * module;
2932
2933 if(prop->_class->module)
2934 module = FindModule(prop->_class->module);
2935 else
2936 module = mainModule;
2937 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = prop->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
2938 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
2939 }
2940 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2941 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport), ((struct PropertyImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), ((struct PropertyImport *)__ecereTemp1)->isVirtual = 0x0, ((struct PropertyImport *)__ecereTemp1)->hasSet = prop->Set ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1)->hasGet = prop->Get ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1));
2942 if(classSym)
2943 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
2944 }
2945 imported = 0x1;
2946 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + 12)))->importType != 1)
2947 dllImport = 0x1;
2948 }
2949 if(!symbol->type)
2950 {
2951 struct Context * context = SetupTemplatesContext(prop->_class);
2952
2953 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
2954 FinishTemplatesContext(context);
2955 }
2956 if(prop->Get)
2957 {
2958 if(!symbol->externalGet || symbol->externalGet->type == 0)
2959 {
2960 struct Declaration * decl;
2961 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2962 struct Declarator * d;
2963 struct __ecereNameSpace__ecere__sys__OldList * params;
2964 struct Specifier * spec;
2965 struct External * external;
2966 struct Declarator * typeDecl;
2967 unsigned int simple = 0x0;
2968
2969 specifiers = MkList();
2970 declarators = MkList();
2971 params = MkList();
2972 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
2973 d = MkDeclaratorIdentifier(MkIdentifier(getName));
2974 if(dllImport)
2975 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
2976 {
2977 struct Context * context = SetupTemplatesContext(prop->_class);
2978
2979 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
2980 FinishTemplatesContext(context);
2981 }
2982 for(spec = (*specifiers).first; spec; spec = spec->next)
2983 {
2984 if(spec->type == 1)
2985 {
2986 if((!typeDecl || typeDecl->type == 1))
2987 {
2988 struct Symbol * classSym = spec->symbol;
2989
2990 symbol->_class = classSym->registered;
2991 if(classSym->registered && classSym->registered->type == 1)
2992 {
2993 DeclareStruct(spec->name, 0x0);
2994 simple = 0x1;
2995 }
2996 }
2997 }
2998 }
2999 if(!simple)
3000 d = PlugDeclarator(typeDecl, d);
3001 else
3002 {
3003 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3004 specifiers = MkList();
3005 }
3006 d = MkDeclaratorFunction(d, params);
3007 if(dllImport)
3008 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3009 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3010 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3011 if(simple)
3012 ListAdd(specifiers, MkSpecifier(VOID));
3013 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3014 decl = MkDeclaration(specifiers, declarators);
3015 external = MkExternalDeclaration(decl);
3016 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3017 external->symbol = symbol;
3018 symbol->externalGet = external;
3019 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3020 if(typeDecl)
3021 FreeDeclarator(typeDecl);
3022 }
3023 else
3024 {
3025 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3026 }
3027 }
3028 if(prop->Set)
3029 {
3030 if(!symbol->externalSet || symbol->externalSet->type == 0)
3031 {
3032 struct Declaration * decl;
3033 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3034 struct Declarator * d;
3035 struct __ecereNameSpace__ecere__sys__OldList * params;
3036 struct Specifier * spec;
3037 struct External * external;
3038 struct Declarator * typeDecl;
3039
3040 declarators = MkList();
3041 params = MkList();
3042 if(!prop->conversion || prop->_class->type == 1)
3043 {
3044 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3045 }
3046 specifiers = MkList();
3047 {
3048 struct Context * context = SetupTemplatesContext(prop->_class);
3049
3050 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3051 FinishTemplatesContext(context);
3052 }
3053 ListAdd(params, MkTypeName(specifiers, d));
3054 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3055 if(dllImport)
3056 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3057 d = MkDeclaratorFunction(d, params);
3058 for(spec = (*specifiers).first; spec; spec = spec->next)
3059 {
3060 if(spec->type == 1)
3061 {
3062 if((!typeDecl || typeDecl->type == 1))
3063 {
3064 struct Symbol * classSym = spec->symbol;
3065
3066 symbol->_class = classSym->registered;
3067 if(classSym->registered && classSym->registered->type == 1)
3068 DeclareStruct(spec->name, 0x0);
3069 }
3070 }
3071 }
3072 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3073 specifiers = MkList();
3074 if(dllImport)
3075 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3076 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3077 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3078 if(!prop->conversion || prop->_class->type == 1)
3079 ListAdd(specifiers, MkSpecifier(VOID));
3080 else
3081 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3082 decl = MkDeclaration(specifiers, declarators);
3083 external = MkExternalDeclaration(decl);
3084 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3085 external->symbol = symbol;
3086 symbol->externalSet = external;
3087 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3088 }
3089 else
3090 {
3091 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3092 }
3093 }
3094 if(!symbol->externalPtr)
3095 {
3096 struct Declaration * decl;
3097 struct External * external;
3098 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3099
3100 if(imported)
3101 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3102 else
3103 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3104 ListAdd(specifiers, MkSpecifierName("Property"));
3105 {
3106 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3107
3108 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3109 if(!imported)
3110 {
3111 strcpy(propName, "__ecerePropM_");
3112 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3113 strcat(propName, "_");
3114 FullClassNameCat(propName, prop->name, 0x1);
3115 MangleClassName(propName);
3116 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3117 }
3118 decl = MkDeclaration(specifiers, list);
3119 }
3120 external = MkExternalDeclaration(decl);
3121 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3122 external->symbol = symbol;
3123 symbol->externalPtr = external;
3124 }
3125 else
3126 {
3127 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3128 }
3129 symbol->id = curExternal->symbol->idCode;
3130 }
3131 }
3132
3133 struct Type * Dereference(struct Type * source)
3134 {
3135 void * __ecereTemp1;
3136 struct Type * type = (((void *)0));
3137
3138 if(source)
3139 {
3140 if(source->kind == 13 || source->kind == 12)
3141 {
3142 type = source->type;
3143 source->type->refCount++;
3144 }
3145 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3146 {
3147 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3148 }
3149 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3150 {
3151 type = source;
3152 source->refCount++;
3153 }
3154 else
3155 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3156 }
3157 return type;
3158 }
3159
3160 static struct Type * Reference(struct Type * source)
3161 {
3162 void * __ecereTemp1;
3163 struct Type * type = (((void *)0));
3164
3165 if(source)
3166 {
3167 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = source, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3168 source->refCount++;
3169 }
3170 return type;
3171 }
3172
3173 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);
3174
3175 extern void *  memcpy(void * , const void * , unsigned int size);
3176
3177 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3178
3179 extern void FreeExpression(struct Expression * exp);
3180
3181 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3182
3183 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);
3184
3185 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3186
3187 extern struct Type * MkClassType(char *  name);
3188
3189 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);
3190
3191 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)
3192 {
3193 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3194 unsigned int found = 0x0;
3195 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3196 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3197 unsigned int freeType = 0x0;
3198
3199 yylloc = member->loc;
3200 if(!ident)
3201 {
3202 if(curMember)
3203 {
3204 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3205 if(*curMember)
3206 {
3207 found = 0x1;
3208 dataMember = *curMember;
3209 }
3210 }
3211 }
3212 else
3213 {
3214 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3215 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3216 int _subMemberStackPos = 0;
3217
3218 if(!thisMember)
3219 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3220 if(thisMember)
3221 {
3222 dataMember = thisMember;
3223 if(curMember && thisMember->memberAccess == 1)
3224 {
3225 *curMember = thisMember;
3226 *curClass = thisMember->_class;
3227 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
3228 *subMemberStackPos = _subMemberStackPos;
3229 }
3230 found = 0x1;
3231 }
3232 else
3233 {
3234 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3235 if(method && method->type == 1)
3236 found = 0x1;
3237 else
3238 method = (((void *)0));
3239 }
3240 }
3241 if(found)
3242 {
3243 struct Type * type = (((void *)0));
3244
3245 if(dataMember)
3246 {
3247 if(!dataMember->dataType && dataMember->dataTypeString)
3248 {
3249 struct Context * context = SetupTemplatesContext(_class);
3250
3251 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3252 FinishTemplatesContext(context);
3253 }
3254 type = dataMember->dataType;
3255 }
3256 else if(method)
3257 {
3258 if(!method->dataType)
3259 ProcessMethodType(method);
3260 type = method->dataType;
3261 }
3262 if(ident && ident->next)
3263 {
3264 for(ident = ident->next; ident && type; ident = ident->next)
3265 {
3266 if(type->kind == 8)
3267 {
3268 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3269 if(!dataMember)
3270 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3271 if(dataMember)
3272 type = dataMember->dataType;
3273 }
3274 else if(type->kind == 9 || type->kind == 10)
3275 {
3276 struct Type * memberType;
3277
3278 for(memberType = type->members.first; memberType; memberType = memberType->next)
3279 {
3280 if(!strcmp(memberType->name, ident->string))
3281 {
3282 type = memberType;
3283 break;
3284 }
3285 }
3286 }
3287 }
3288 }
3289 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3290 {
3291 int id = 0;
3292 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3293 struct __ecereNameSpace__ecere__com__Class * sClass;
3294
3295 for(sClass = _class; sClass; sClass = sClass->base)
3296 {
3297 id = 0;
3298 if(sClass->templateClass)
3299 sClass = sClass->templateClass;
3300 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3301 {
3302 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3303 {
3304 for(sClass = sClass->base; sClass; sClass = sClass->base)
3305 {
3306 if(sClass->templateClass)
3307 sClass = sClass->templateClass;
3308 id += sClass->templateParams.count;
3309 }
3310 break;
3311 }
3312 id++;
3313 }
3314 if(curParam)
3315 break;
3316 }
3317 if(curParam)
3318 {
3319 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3320
3321 if(arg.dataTypeString)
3322 {
3323 type = ProcessTypeString(arg.dataTypeString, 0x0);
3324 freeType = 0x1;
3325 if(type && _class->templateClass)
3326 type->passAsTemplate = 0x1;
3327 if(type)
3328 {
3329 }
3330 }
3331 }
3332 }
3333 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3334 {
3335 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3336 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3337 int c;
3338 int paramCount = 0;
3339 int lastParam = -1;
3340 char templateString[1024];
3341 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3342
3343 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3344 for(cClass = expClass; cClass; cClass = cClass->base)
3345 {
3346 int p = 0;
3347
3348 if(cClass->templateClass)
3349 cClass = cClass->templateClass;
3350 for(param = cClass->templateParams.first; param; param = param->next)
3351 {
3352 int id = p;
3353 struct __ecereNameSpace__ecere__com__Class * sClass;
3354 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3355
3356 for(sClass = cClass->base; sClass; sClass = sClass->base)
3357 {
3358 if(sClass->templateClass)
3359 sClass = sClass->templateClass;
3360 id += sClass->templateParams.count;
3361 }
3362 arg = expClass->templateArgs[id];
3363 for(sClass = _class; sClass; sClass = sClass->base)
3364 {
3365 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3366 int p = 0;
3367 struct __ecereNameSpace__ecere__com__Class * nextClass;
3368
3369 if(sClass->templateClass)
3370 sClass = sClass->templateClass;
3371 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3372 {
3373 if(nextClass->templateClass)
3374 nextClass = nextClass->templateClass;
3375 p += nextClass->templateParams.count;
3376 }
3377 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3378 {
3379 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3380 {
3381 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3382 {
3383 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3384 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3385 break;
3386 }
3387 }
3388 }
3389 }
3390 {
3391 char argument[256];
3392
3393 argument[0] = '\0';
3394 switch(param->type)
3395 {
3396 case 2:
3397 {
3398 char expString[1024];
3399 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3400 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3401 struct Expression * exp;
3402 char * string = PrintHexUInt64(arg.expression.ui64);
3403
3404 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3405 ProcessExpressionType(exp);
3406 ComputeExpression(exp);
3407 expString[0] = '\0';
3408 PrintExpression(exp, expString);
3409 strcat(argument, expString);
3410 FreeExpression(exp);
3411 break;
3412 }
3413 case 1:
3414 {
3415 strcat(argument, arg.member->name);
3416 break;
3417 }
3418 case 0:
3419 {
3420 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3421 strcat(argument, arg.dataTypeString);
3422 break;
3423 }
3424 }
3425 if(argument[0])
3426 {
3427 if(paramCount)
3428 strcat(templateString, ", ");
3429 if(lastParam != p - 1)
3430 {
3431 strcat(templateString, param->name);
3432 strcat(templateString, " = ");
3433 }
3434 strcat(templateString, argument);
3435 paramCount++;
3436 lastParam = p;
3437 }
3438 p++;
3439 }
3440 }
3441 }
3442 {
3443 int len = strlen(templateString);
3444
3445 if(templateString[len - 1] == '<')
3446 len--;
3447 else
3448 {
3449 if(templateString[len - 1] == '>')
3450 templateString[len++] = ' ';
3451 templateString[len++] = '>';
3452 }
3453 templateString[len++] = '\0';
3454 }
3455 {
3456 struct Context * context = SetupTemplatesContext(_class);
3457
3458 if(freeType)
3459 FreeType(type);
3460 type = ProcessTypeString(templateString, 0x0);
3461 freeType = 0x1;
3462 FinishTemplatesContext(context);
3463 }
3464 }
3465 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3466 {
3467 ProcessExpressionType(member->initializer->exp);
3468 if(!member->initializer->exp->expType)
3469 {
3470 if(inCompiler)
3471 {
3472 char expString[10240];
3473
3474 expString[0] = '\0';
3475 PrintExpression(member->initializer->exp, expString);
3476 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3477 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3478 }
3479 }
3480 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3481 {
3482 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3483 }
3484 }
3485 else if(member->initializer)
3486 {
3487 ProcessInitializer(member->initializer, type);
3488 }
3489 if(freeType)
3490 FreeType(type);
3491 }
3492 else
3493 {
3494 if(_class && _class->type == 3)
3495 {
3496 if(member->initializer)
3497 {
3498 struct Type * type = MkClassType(_class->fullName);
3499
3500 ProcessInitializer(member->initializer, type);
3501 FreeType(type);
3502 }
3503 }
3504 else
3505 {
3506 if(member->initializer)
3507 {
3508 ProcessInitializer(member->initializer, (((void *)0)));
3509 }
3510 if(ident)
3511 {
3512 if(method)
3513 {
3514 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3515 }
3516 else if(_class)
3517 {
3518 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3519 if(inCompiler)
3520 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3521 }
3522 }
3523 else if(_class)
3524 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3525 }
3526 }
3527 }
3528
3529 extern struct Identifier * GetDeclId(struct Declarator * decl);
3530
3531 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);
3532
3533 extern void FreeSpecifier(struct Specifier * spec);
3534
3535 static void ProcessFunction(struct FunctionDefinition * function);
3536
3537 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (* )(void * ));
3538
3539 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3540
3541 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3542
3543 extern void FreeClassFunction(struct ClassFunction * func);
3544
3545 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3546
3547 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3548
3549 void ProcessInstantiationType(struct Instantiation * inst)
3550 {
3551 yylloc = inst->loc;
3552 if(inst->_class)
3553 {
3554 struct MembersInit * members;
3555 struct Symbol * classSym;
3556 struct __ecereNameSpace__ecere__com__Class * _class;
3557
3558 classSym = inst->_class->symbol;
3559 _class = classSym ? classSym->registered : (((void *)0));
3560 if(!_class || _class->type != 5)
3561 DeclareStruct(inst->_class->name, 0x0);
3562 afterExternal = afterExternal ? afterExternal : curExternal;
3563 if(inst->exp)
3564 ProcessExpressionType(inst->exp);
3565 inst->isConstant = 0x1;
3566 if(inst->members)
3567 {
3568 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3569 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3570 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3571 int subMemberStackPos = 0;
3572
3573 for(members = (*inst->members).first; members; members = members->next)
3574 {
3575 switch(members->type)
3576 {
3577 case 1:
3578 {
3579 char name[1024];
3580 static unsigned int instMethodID = 0;
3581 struct External * external = curExternal;
3582 struct Context * context = curContext;
3583 struct Declarator * declarator = members->function->declarator;
3584 struct Identifier * nameID = GetDeclId(declarator);
3585 char * unmangled = nameID ? nameID->string : (((void *)0));
3586 struct Expression * exp;
3587 struct External * createdExternal = (((void *)0));
3588
3589 if(inCompiler)
3590 {
3591 char number[16];
3592
3593 strcpy(name, "__ecereInstMeth_");
3594 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3595 strcat(name, "_");
3596 strcat(name, nameID->string);
3597 strcat(name, "_");
3598 sprintf(number, "_%08d", instMethodID++);
3599 strcat(name, number);
3600 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3601 }
3602 if(declarator)
3603 {
3604 struct Symbol * symbol = declarator->symbol;
3605 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3606
3607 if(method && method->type == 1)
3608 {
3609 symbol->method = method;
3610 ProcessMethodType(method);
3611 if(!symbol->type->thisClass)
3612 {
3613 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3614 {
3615 if(!currentClass->symbol)
3616 currentClass->symbol = FindClass(currentClass->fullName);
3617 symbol->type->thisClass = currentClass->symbol;
3618 }
3619 else
3620 {
3621 if(!_class->symbol)
3622 _class->symbol = FindClass(_class->fullName);
3623 symbol->type->thisClass = _class->symbol;
3624 }
3625 }
3626 DeclareType(symbol->type, 0x1, 0x1);
3627 }
3628 else if(classSym)
3629 {
3630 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3631 }
3632 }
3633 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3634 if(nameID)
3635 {
3636 FreeSpecifier(nameID->_class);
3637 nameID->_class = (((void *)0));
3638 }
3639 if(inCompiler)
3640 {
3641 struct Type * type = declarator->symbol->type;
3642 struct External * oldExternal = curExternal;
3643
3644 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3645 {
3646 struct External * externalDecl;
3647
3648 externalDecl = MkExternalDeclaration((((void *)0)));
3649 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3650 if(createdExternal->function)
3651 {
3652 ProcessFunction(createdExternal->function);
3653 {
3654 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3655
3656 externalDecl->declaration = decl;
3657 if(decl->symbol && !decl->symbol->pointerExternal)
3658 decl->symbol->pointerExternal = externalDecl;
3659 declarator->symbol->pointerExternal = externalDecl;
3660 }
3661 }
3662 }
3663 }
3664 else if(declarator)
3665 {
3666 curExternal = declarator->symbol->pointerExternal;
3667 ProcessFunction((struct FunctionDefinition *)members->function);
3668 }
3669 curExternal = external;
3670 curContext = context;
3671 if(inCompiler)
3672 {
3673 FreeClassFunction(members->function);
3674 exp = QMkExpId(name);
3675 members->type = 0;
3676 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3677 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3678 }
3679 break;
3680 }
3681 case 0:
3682 {
3683 if(members->dataMembers && classSym)
3684 {
3685 struct MemberInit * member;
3686 struct Location oldyyloc = yylloc;
3687
3688 for(member = (*members->dataMembers).first; member; member = member->next)
3689 {
3690 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3691 if(member->initializer && !member->initializer->isConstant)
3692 inst->isConstant = 0x0;
3693 }
3694 yylloc = oldyyloc;
3695 }
3696 break;
3697 }
3698 }
3699 }
3700 }
3701 }
3702 }
3703
3704 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3705 {
3706 if(inCompiler)
3707 {
3708 if(type->kind == 11)
3709 {
3710 struct Type * param;
3711
3712 if(declareParams)
3713 {
3714 for(param = type->params.first; param; param = param->next)
3715 DeclareType(param, declarePointers, 0x1);
3716 }
3717 DeclareType(type->returnType, declarePointers, 0x1);
3718 }
3719 else if(type->kind == 13 && declarePointers)
3720 DeclareType(type->type, declarePointers, 0x0);
3721 else if(type->kind == 8)
3722 {
3723 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3724 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3725 }
3726 else if(type->kind == 9 || type->kind == 10)
3727 {
3728 struct Type * member;
3729
3730 for(member = type->members.first; member; member = member->next)
3731 DeclareType(member, 0x0, 0x0);
3732 }
3733 else if(type->kind == 12)
3734 DeclareType(type->arrayType, declarePointers, 0x0);
3735 }
3736 }
3737
3738 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3739
3740 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3741 {
3742 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3743 int id = 0;
3744 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3745 struct __ecereNameSpace__ecere__com__Class * sClass;
3746
3747 for(sClass = _class; sClass; sClass = sClass->base)
3748 {
3749 id = 0;
3750 if(sClass->templateClass)
3751 sClass = sClass->templateClass;
3752 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3753 {
3754 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3755 {
3756 for(sClass = sClass->base; sClass; sClass = sClass->base)
3757 {
3758 if(sClass->templateClass)
3759 sClass = sClass->templateClass;
3760 id += sClass->templateParams.count;
3761 }
3762 break;
3763 }
3764 id++;
3765 }
3766 if(curParam)
3767 break;
3768 }
3769 if(curParam)
3770 {
3771 arg = &_class->templateArgs[id];
3772 if(arg && param->type == 0)
3773 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3774 }
3775 return arg;
3776 }
3777
3778 extern struct Context * PushContext(void);
3779
3780 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3781
3782 struct TemplatedType
3783 {
3784 unsigned int key;
3785 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3786 struct __ecereNameSpace__ecere__sys__BTNode * left;
3787 struct __ecereNameSpace__ecere__sys__BTNode * right;
3788 int depth;
3789 struct TemplateParameter * param;
3790 } __attribute__ ((gcc_struct));
3791
3792 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
3793
3794 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
3795 {
3796 void * __ecereTemp1;
3797 struct Context * context = PushContext();
3798
3799 context->templateTypesOnly = 0x1;
3800 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
3801 {
3802 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
3803
3804 for(; param; param = param->next)
3805 {
3806 if(param->type == 0 && param->identifier)
3807 {
3808 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (unsigned int)param->identifier->string, type->param = param, type);
3809
3810 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3811 }
3812 }
3813 }
3814 else if(_class)
3815 {
3816 struct __ecereNameSpace__ecere__com__Class * sClass;
3817
3818 for(sClass = _class; sClass; sClass = sClass->base)
3819 {
3820 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
3821
3822 for(p = sClass->templateParams.first; p; p = p->next)
3823 {
3824 if(p->type == 0)
3825 {
3826 struct TemplateParameter * param = p->param;
3827 struct TemplatedType * type;
3828
3829 if(!param)
3830 {
3831 p->param = param = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter), ((struct TemplateParameter *)__ecereTemp1)->identifier = MkIdentifier(p->name), ((struct TemplateParameter *)__ecereTemp1)->type = p->type, ((struct TemplateParameter *)__ecereTemp1)->dataTypeString = p->dataTypeString, ((struct TemplateParameter *)__ecereTemp1));
3832 }
3833 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), ((struct TemplatedType *)__ecereTemp1)->key = (unsigned int)p->name, ((struct TemplatedType *)__ecereTemp1)->param = param, ((struct TemplatedType *)__ecereTemp1));
3834 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3835 }
3836 }
3837 }
3838 }
3839 return context;
3840 }
3841
3842 extern void PopContext(struct Context * ctx);
3843
3844 extern void FreeContext(struct Context * context);
3845
3846 void FinishTemplatesContext(struct Context * context)
3847 {
3848 PopContext(context);
3849 FreeContext(context);
3850 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
3851 }
3852
3853 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
3854 {
3855 if(!method->dataType)
3856 {
3857 struct Context * context = SetupTemplatesContext(method->_class);
3858
3859 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
3860 FinishTemplatesContext(context);
3861 if(method->type != 1 && method->dataType)
3862 {
3863 if(!method->dataType->thisClass && !method->dataType->staticMethod)
3864 {
3865 if(!method->_class->symbol)
3866 method->_class->symbol = FindClass(method->_class->fullName);
3867 method->dataType->thisClass = method->_class->symbol;
3868 }
3869 }
3870 }
3871 }
3872
3873 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
3874 {
3875 if(!prop->dataType)
3876 {
3877 struct Context * context = SetupTemplatesContext(prop->_class);
3878
3879 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
3880 FinishTemplatesContext(context);
3881 }
3882 }
3883
3884 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
3885
3886 extern void FreeTypeName(struct TypeName * typeName);
3887
3888 static void ProcessDeclarator(struct Declarator * decl);
3889
3890 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
3891
3892 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
3893
3894 struct MethodImport
3895 {
3896 struct MethodImport * prev;
3897 struct MethodImport * next;
3898 char *  name;
3899 unsigned int isVirtual;
3900 } __attribute__ ((gcc_struct));
3901
3902 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3903
3904 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
3905 {
3906 void * __ecereTemp1;
3907 struct Symbol * symbol = method->symbol;
3908
3909 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
3910 {
3911 unsigned int imported = 0x0;
3912 unsigned int dllImport = 0x0;
3913
3914 if(!method->dataType)
3915 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
3916 if(!symbol || symbol->_import || method->type == 1)
3917 {
3918 if(!symbol || method->type == 1)
3919 {
3920 struct Symbol * classSym;
3921
3922 if(!method->_class->symbol)
3923 method->_class->symbol = FindClass(method->_class->fullName);
3924 classSym = method->_class->symbol;
3925 if(!classSym->_import)
3926 {
3927 struct ModuleImport * module;
3928
3929 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->name)
3930 module = FindModule(method->_class->module);
3931 else
3932 module = mainModule;
3933 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = method->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
3934 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3935 }
3936 if(!symbol)
3937 {
3938 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3939 }
3940 if(!symbol->_import)
3941 {
3942 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport), ((struct MethodImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->name), ((struct MethodImport *)__ecereTemp1)->isVirtual = method->type == 1, ((struct MethodImport *)__ecereTemp1));
3943 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
3944 }
3945 if(!symbol)
3946 {
3947 symbol->type = method->dataType;
3948 if(symbol->type)
3949 symbol->type->refCount++;
3950 }
3951 }
3952 if(!method->dataType->dllExport)
3953 {
3954 imported = 0x1;
3955 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->importType != 1)
3956 dllImport = 0x1;
3957 }
3958 }
3959 if(method->type != 1 && method->dataType)
3960 DeclareType(method->dataType, 0x1, 0x1);
3961 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
3962 {
3963 struct Declaration * decl;
3964 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3965 struct Declarator * d;
3966 struct Declarator * funcDecl;
3967 struct External * external;
3968
3969 specifiers = MkList();
3970 declarators = MkList();
3971 if(dllImport)
3972 ListAdd(specifiers, MkSpecifier(EXTERN));
3973 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
3974 ListAdd(specifiers, MkSpecifier(STATIC));
3975 if(method->type == 1)
3976 {
3977 ListAdd(specifiers, MkSpecifier(INT));
3978 d = MkDeclaratorIdentifier(MkIdentifier(name));
3979 }
3980 else
3981 {
3982 d = MkDeclaratorIdentifier(MkIdentifier(name));
3983 if(dllImport)
3984 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3985 {
3986 struct Context * context = SetupTemplatesContext(method->_class);
3987
3988 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
3989 FinishTemplatesContext(context);
3990 }
3991 funcDecl = GetFuncDecl(d);
3992 if(dllImport)
3993 {
3994 struct Specifier * spec, * next;
3995
3996 for(spec = (*specifiers).first; spec; spec = next)
3997 {
3998 next = spec->next;
3999 if(spec->type == 5)
4000 {
4001 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4002 FreeSpecifier(spec);
4003 }
4004 }
4005 }
4006 if(method->dataType && !method->dataType->staticMethod)
4007 {
4008 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4009 {
4010 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4011 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")));
4012 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4013 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4014
4015 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4016 {
4017 struct TypeName * param = (*funcDecl->function.parameters).first;
4018
4019 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4020 FreeTypeName(param);
4021 }
4022 if(!funcDecl->function.parameters)
4023 funcDecl->function.parameters = MkList();
4024 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4025 }
4026 }
4027 }
4028 ProcessDeclarator(d);
4029 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4030 decl = MkDeclaration(specifiers, declarators);
4031 ReplaceThisClassSpecifiers(specifiers, method->_class);
4032 if(symbol->pointerExternal)
4033 {
4034 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4035
4036 {
4037 *functionSymbol = *symbol;
4038 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4039 if(functionSymbol->type)
4040 functionSymbol->type->refCount++;
4041 }
4042 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4043 symbol->pointerExternal->symbol = functionSymbol;
4044 }
4045 external = MkExternalDeclaration(decl);
4046 if(curExternal)
4047 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4048 external->symbol = symbol;
4049 symbol->pointerExternal = external;
4050 }
4051 else if(ast)
4052 {
4053 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4054 }
4055 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4056 }
4057 }
4058
4059 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4060 {
4061 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4062 {
4063 unsigned int first = 0x1;
4064 int p = 0;
4065 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4066 int lastParam = -1;
4067 char className[1024];
4068
4069 strcpy(className, _class->fullName);
4070 for(param = _class->templateParams.first; param; param = param->next)
4071 {
4072 {
4073 if(first)
4074 strcat(className, "<");
4075 if(!first)
4076 strcat(className, ", ");
4077 if(lastParam + 1 != p)
4078 {
4079 strcat(className, param->name);
4080 strcat(className, " = ");
4081 }
4082 strcat(className, param->name);
4083 first = 0x0;
4084 lastParam = p;
4085 }
4086 p++;
4087 }
4088 if(!first)
4089 {
4090 int len = strlen(className);
4091
4092 if(className[len - 1] == '>')
4093 className[len++] = ' ';
4094 className[len++] = '>';
4095 className[len++] = '\0';
4096 }
4097 return __ecereNameSpace__ecere__sys__CopyString(className);
4098 }
4099 else
4100 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4101 }
4102
4103 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4104 {
4105 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4106 {
4107 unsigned int first = 0x1;
4108 int p = 0;
4109 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4110 int lastParam = -1;
4111 char className[1024];
4112
4113 strcpy(className, _class->fullName);
4114 for(param = _class->templateParams.first; param; param = param->next)
4115 {
4116 {
4117 if(first)
4118 strcat(className, "<");
4119 if(!first)
4120 strcat(className, ", ");
4121 if(lastParam + 1 != p)
4122 {
4123 strcat(className, param->name);
4124 strcat(className, " = ");
4125 }
4126 strcat(className, param->name);
4127 first = 0x0;
4128 lastParam = p;
4129 }
4130 p++;
4131 }
4132 if(!first)
4133 {
4134 int len = strlen(className);
4135
4136 if(className[len - 1] == '>')
4137 className[len++] = ' ';
4138 className[len++] = '>';
4139 className[len++] = '\0';
4140 }
4141 return MkClassType(className);
4142 }
4143 else
4144 {
4145 return MkClassType(_class->fullName);
4146 }
4147 }
4148
4149 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4150 {
4151 if(specs != (((void *)0)) && _class)
4152 {
4153 struct Specifier * spec;
4154
4155 for(spec = specs->first; spec; spec = spec->next)
4156 {
4157 if(spec->type == 0 && spec->specifier == THISCLASS)
4158 {
4159 spec->type = 1;
4160 spec->name = ReplaceThisClass(_class);
4161 spec->symbol = FindClass(spec->name);
4162 }
4163 }
4164 }
4165 }
4166
4167 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4168
4169 struct __ecereNameSpace__ecere__com__GlobalFunction
4170 {
4171 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4172 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4173 char *  name;
4174 int (*  function)();
4175 struct __ecereNameSpace__ecere__com__Instance * module;
4176 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4177 char *  dataTypeString;
4178 struct Type * dataType;
4179 void *  symbol;
4180 } __attribute__ ((gcc_struct));
4181
4182 extern struct Context * globalContext;
4183
4184 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4185
4186 struct FunctionImport
4187 {
4188 struct FunctionImport * prev;
4189 struct FunctionImport * next;
4190 char *  name;
4191 } __attribute__ ((gcc_struct));
4192
4193 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4194 {
4195 void * __ecereTemp1;
4196 struct Symbol * symbol = function->symbol;
4197
4198 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4199 {
4200 unsigned int imported = 0x0;
4201 unsigned int dllImport = 0x0;
4202
4203 if(!function->dataType)
4204 {
4205 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4206 if(!function->dataType->thisClass)
4207 function->dataType->staticMethod = 0x1;
4208 }
4209 if(inCompiler)
4210 {
4211 if(!symbol)
4212 {
4213 struct ModuleImport * module = FindModule(function->module);
4214
4215 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4216 if(module->name)
4217 {
4218 if(!function->dataType->dllExport)
4219 {
4220 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport), ((struct FunctionImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(function->name), ((struct FunctionImport *)__ecereTemp1));
4221 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4222 }
4223 }
4224 {
4225 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4226 if(!symbol->type->thisClass)
4227 symbol->type->staticMethod = 0x1;
4228 }
4229 }
4230 imported = symbol->_import ? 0x1 : 0x0;
4231 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1)
4232 dllImport = 0x1;
4233 }
4234 DeclareType(function->dataType, 0x1, 0x1);
4235 if(inCompiler)
4236 {
4237 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4238 {
4239 struct Declaration * decl;
4240 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4241 struct Declarator * d;
4242 struct Declarator * funcDecl;
4243 struct External * external;
4244
4245 specifiers = MkList();
4246 declarators = MkList();
4247 ListAdd(specifiers, MkSpecifier(EXTERN));
4248 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4249 if(dllImport)
4250 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4251 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4252 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType == 1)
4253 {
4254 struct Specifier * spec;
4255
4256 for(spec = (*specifiers).first; spec; spec = spec->next)
4257 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4258 {
4259 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4260 FreeSpecifier(spec);
4261 break;
4262 }
4263 }
4264 funcDecl = GetFuncDecl(d);
4265 if(funcDecl && !funcDecl->function.parameters)
4266 {
4267 funcDecl->function.parameters = MkList();
4268 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4269 }
4270 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4271 {
4272 struct Context * oldCtx = curContext;
4273
4274 curContext = globalContext;
4275 decl = MkDeclaration(specifiers, declarators);
4276 curContext = oldCtx;
4277 }
4278 if(symbol->pointerExternal)
4279 {
4280 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4281
4282 {
4283 *functionSymbol = *symbol;
4284 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4285 if(functionSymbol->type)
4286 functionSymbol->type->refCount++;
4287 }
4288 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4289 symbol->pointerExternal->symbol = functionSymbol;
4290 }
4291 external = MkExternalDeclaration(decl);
4292 if(curExternal)
4293 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4294 external->symbol = symbol;
4295 symbol->pointerExternal = external;
4296 }
4297 else
4298 {
4299 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4300 }
4301 if(curExternal)
4302 symbol->id = curExternal->symbol->idCode;
4303 }
4304 }
4305 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1) ? 0x1 : 0x0;
4306 }
4307
4308 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4309
4310 struct GlobalData
4311 {
4312 unsigned int key;
4313 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4314 struct __ecereNameSpace__ecere__sys__BTNode * left;
4315 struct __ecereNameSpace__ecere__sys__BTNode * right;
4316 int depth;
4317 struct __ecereNameSpace__ecere__com__Instance * module;
4318 char *  dataTypeString;
4319 struct Type * dataType;
4320 void *  symbol;
4321 char *  fullName;
4322 } __attribute__ ((gcc_struct));
4323
4324 void DeclareGlobalData(struct GlobalData * data)
4325 {
4326 struct Symbol * symbol = data->symbol;
4327
4328 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4329 {
4330 if(inCompiler)
4331 {
4332 if(!symbol)
4333 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4334 }
4335 if(!data->dataType)
4336 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4337 DeclareType(data->dataType, 0x1, 0x1);
4338 if(inCompiler)
4339 {
4340 if(!symbol->pointerExternal)
4341 {
4342 struct Declaration * decl;
4343 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4344 struct Declarator * d;
4345 struct External * external;
4346
4347 specifiers = MkList();
4348 declarators = MkList();
4349 ListAdd(specifiers, MkSpecifier(EXTERN));
4350 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4351 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4352 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4353 decl = MkDeclaration(specifiers, declarators);
4354 external = MkExternalDeclaration(decl);
4355 if(curExternal)
4356 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4357 external->symbol = symbol;
4358 symbol->pointerExternal = external;
4359 }
4360 else
4361 {
4362 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4363 }
4364 if(curExternal)
4365 symbol->id = curExternal->symbol->idCode;
4366 }
4367 }
4368 }
4369
4370 struct Conversion
4371 {
4372 struct Conversion * prev, * next;
4373 struct __ecereNameSpace__ecere__com__Property * convert;
4374 unsigned int isGet;
4375 struct Type * resultType;
4376 } __attribute__ ((gcc_struct));
4377
4378 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4379
4380 extern void Compiler_Warning(char *  format, ...);
4381
4382 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4383
4384 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)
4385 {
4386 if(source && dest)
4387 {
4388 if(source->kind == 20 && dest->kind != 20)
4389 {
4390 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4391
4392 if(type)
4393 source = type;
4394 }
4395 if(dest->kind == 20 && source->kind != 20)
4396 {
4397 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4398
4399 if(type)
4400 dest = type;
4401 }
4402 if((dest->classObjectType == 2 && source->classObjectType != 3) || (dest->classObjectType == 3 && source->classObjectType != 2))
4403 {
4404 return 0x1;
4405 }
4406 if(source->classObjectType == 3 && dest->classObjectType != 2)
4407 {
4408 return 0x1;
4409 }
4410 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4411 {
4412 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4413 return 0x1;
4414 }
4415 if(dest->kind == 14 && source->kind != 0)
4416 return 0x1;
4417 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))
4418 return 0x1;
4419 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))
4420 return 0x1;
4421 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4422 {
4423 if(source->_class->registered && source->_class->registered->type == 3)
4424 {
4425 if(conversions != (((void *)0)))
4426 {
4427 if(source->_class->registered == dest->_class->registered)
4428 return 0x1;
4429 }
4430 else
4431 {
4432 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4433
4434 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4435 ;
4436 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4437 ;
4438 if(sourceBase == destBase)
4439 return 0x1;
4440 }
4441 }
4442 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))
4443 return 0x1;
4444 else
4445 {
4446 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && source->_class && source->_class->registered && source->_class->registered->type != 4)
4447 {
4448 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4449 {
4450 return 0x1;
4451 }
4452 }
4453 }
4454 }
4455 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4456 return 0x1;
4457 if(doConversion)
4458 {
4459 if(source->kind == 8)
4460 {
4461 struct __ecereNameSpace__ecere__com__Class * _class;
4462
4463 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4464 {
4465 struct __ecereNameSpace__ecere__com__Property * convert;
4466
4467 for(convert = _class->conversions.first; convert; convert = convert->next)
4468 {
4469 if(convert->memberAccess == 1 || _class->module == privateModule)
4470 {
4471 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4472
4473 if(!convert->dataType)
4474 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4475 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4476 {
4477 if(!conversions && !convert->Get)
4478 return 0x1;
4479 else if(conversions != (((void *)0)))
4480 {
4481 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))
4482 return 0x1;
4483 else
4484 {
4485 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4486
4487 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4488 return 0x1;
4489 }
4490 }
4491 }
4492 }
4493 }
4494 }
4495 }
4496 if(dest->kind == 8)
4497 {
4498 struct __ecereNameSpace__ecere__com__Class * _class;
4499
4500 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4501 {
4502 struct __ecereNameSpace__ecere__com__Property * convert;
4503
4504 for(convert = _class->conversions.first; convert; convert = convert->next)
4505 {
4506 if(convert->memberAccess == 1 || _class->module == privateModule)
4507 {
4508 if(!convert->dataType)
4509 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4510 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4511 {
4512 if(!conversions && !convert->Set)
4513 return 0x1;
4514 else if(conversions != (((void *)0)))
4515 {
4516 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))
4517 return 0x1;
4518 else
4519 {
4520 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4521
4522 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4523 return 0x1;
4524 }
4525 }
4526 }
4527 }
4528 }
4529 }
4530 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4531 {
4532 if(!dest->_class->registered->dataType)
4533 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4534 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4535 {
4536 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4537 {
4538 return 0x1;
4539 }
4540 }
4541 }
4542 }
4543 if(source->kind == 8)
4544 {
4545 struct __ecereNameSpace__ecere__com__Class * _class;
4546
4547 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4548 {
4549 struct __ecereNameSpace__ecere__com__Property * convert;
4550
4551 for(convert = _class->conversions.first; convert; convert = convert->next)
4552 {
4553 if(convert->memberAccess == 1 || _class->module == privateModule)
4554 {
4555 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4556
4557 if(!convert->dataType)
4558 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4559 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4560 {
4561 if(!conversions && !convert->Get)
4562 return 0x1;
4563 else if(conversions != (((void *)0)))
4564 {
4565 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))
4566 return 0x1;
4567 else
4568 {
4569 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4570
4571 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4572 return 0x1;
4573 }
4574 }
4575 }
4576 }
4577 }
4578 }
4579 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4580 {
4581 if(!source->_class->registered->dataType)
4582 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4583 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4584 {
4585 return 0x1;
4586 }
4587 }
4588 }
4589 }
4590 if(source->kind == 8 || source->kind == 19)
4591 ;
4592 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4593 return 0x1;
4594 else if(dest->kind == 7 && source->kind == 6)
4595 return 0x1;
4596 else if(dest->kind == 2 && source->kind == 1)
4597 return 0x1;
4598 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1))
4599 return 0x1;
4600 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3))
4601 return 0x1;
4602 else if(source->kind == 15 && (dest->kind == 3 || dest->kind == 2 || dest->kind == 1 || dest->kind == 5 || dest->kind == 4))
4603 return 0x1;
4604 else if(dest->kind == 15 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 5 || dest->kind == 4))
4605 return 0x1;
4606 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)))
4607 {
4608 struct Type * paramSource, * paramDest;
4609
4610 if(dest->kind == 16)
4611 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4612 if(source->kind == 16)
4613 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4614 if(dest->kind == 13 && dest->type->kind == 11)
4615 dest = dest->type;
4616 if(source->kind == 13 && source->type->kind == 11)
4617 source = source->type;
4618 if(dest->kind == 16)
4619 dest = dest->method->dataType;
4620 if(source->kind == 16)
4621 source = source->method->dataType;
4622 paramSource = source->params.first;
4623 if(paramSource && paramSource->kind == 0)
4624 paramSource = (((void *)0));
4625 paramDest = dest->params.first;
4626 if(paramDest && paramDest->kind == 0)
4627 paramDest = (((void *)0));
4628 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4629 {
4630 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))))
4631 {
4632 if(paramDest && paramDest->kind == 8)
4633 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4634 else
4635 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4636 return 0x0;
4637 }
4638 paramDest = paramDest->next;
4639 }
4640 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4641 {
4642 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4643 {
4644 if(dest->thisClass)
4645 {
4646 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4647 {
4648 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4649 return 0x0;
4650 }
4651 }
4652 else
4653 {
4654 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4655 {
4656 if(owningClassDest)
4657 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4658 else
4659 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4660 return 0x0;
4661 }
4662 }
4663 paramSource = paramSource->next;
4664 }
4665 else
4666 {
4667 if(dest->thisClass)
4668 {
4669 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4670 {
4671 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4672 return 0x0;
4673 }
4674 }
4675 else
4676 {
4677 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4678 {
4679 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4680 return 0x0;
4681 }
4682 }
4683 }
4684 }
4685 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4686 {
4687 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4688 return 0x0;
4689 }
4690 for(; paramDest; paramDest = paramDest->next)
4691 {
4692 if(!paramSource)
4693 {
4694 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4695 return 0x0;
4696 }
4697 {
4698 struct Type * paramDestType = paramDest;
4699 struct Type * paramSourceType = paramSource;
4700 struct Type * type = paramDestType;
4701
4702 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4703 {
4704 int id = 0;
4705 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4706 struct __ecereNameSpace__ecere__com__Class * sClass;
4707
4708 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4709 {
4710 id = 0;
4711 if(sClass->templateClass)
4712 sClass = sClass->templateClass;
4713 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4714 {
4715 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4716 {
4717 for(sClass = sClass->base; sClass; sClass = sClass->base)
4718 {
4719 if(sClass->templateClass)
4720 sClass = sClass->templateClass;
4721 id += sClass->templateParams.count;
4722 }
4723 break;
4724 }
4725 id++;
4726 }
4727 if(curParam)
4728 break;
4729 }
4730 if(curParam)
4731 {
4732 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4733
4734 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4735 }
4736 }
4737 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)))
4738 {
4739 char type[1024];
4740
4741 type[0] = (char)0;
4742 PrintType(paramDest, type, 0x0, 0x1);
4743 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4744 if(paramDestType != paramDest)
4745 FreeType(paramDestType);
4746 return 0x0;
4747 }
4748 if(paramDestType != paramDest)
4749 FreeType(paramDestType);
4750 }
4751 paramSource = paramSource->next;
4752 }
4753 if(paramSource)
4754 {
4755 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4756 return 0x0;
4757 }
4758 return 0x1;
4759 }
4760 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
4761 {
4762 return 0x1;
4763 }
4764 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
4765 {
4766 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4767 return 0x1;
4768 }
4769 }
4770 return 0x0;
4771 }
4772
4773 static void FreeConvert(struct Conversion * convert)
4774 {
4775 if(convert->resultType)
4776 FreeType(convert->resultType);
4777 }
4778
4779 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
4780
4781 struct __ecereNameSpace__ecere__com__BTNamedLink
4782 {
4783 char *  name;
4784 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
4785 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
4786 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
4787 int depth;
4788 void *  data;
4789 } __attribute__ ((gcc_struct));
4790
4791 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
4792
4793 struct __ecereNameSpace__ecere__com__EnumClassData
4794 {
4795 struct __ecereNameSpace__ecere__sys__OldList values;
4796 int largest;
4797 } __attribute__ ((gcc_struct));
4798
4799 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
4800
4801 struct __ecereNameSpace__ecere__sys__NamedLink
4802 {
4803 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
4804 struct __ecereNameSpace__ecere__sys__NamedLink * next;
4805 char *  name;
4806 void *  data;
4807 } __attribute__ ((gcc_struct));
4808
4809 extern void FreeExpContents(struct Expression * exp);
4810
4811 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
4812
4813 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
4814
4815 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
4816
4817 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
4818
4819 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
4820
4821 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
4822 {
4823 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
4824
4825 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)))
4826 {
4827 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
4828
4829 if(_class->type == 4)
4830 {
4831 struct __ecereNameSpace__ecere__sys__OldList converts = 
4832 {
4833 0, 0, 0, 0, 0
4834 };
4835 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
4836
4837 type->kind = 8;
4838 if(!_class->symbol)
4839 _class->symbol = FindClass(_class->fullName);
4840 type->_class = _class->symbol;
4841 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
4842 {
4843 struct __ecereNameSpace__ecere__sys__NamedLink * value;
4844 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
4845
4846 if(enumClass)
4847 {
4848 struct __ecereNameSpace__ecere__com__Class * baseClass;
4849
4850 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
4851 {
4852 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
4853
4854 for(value = e->values.first; value; value = value->next)
4855 {
4856 if(!strcmp(value->name, string))
4857 break;
4858 }
4859 if(value)
4860 {
4861 FreeExpContents(sourceExp);
4862 FreeType(sourceExp->expType);
4863 sourceExp->isConstant = 0x1;
4864 sourceExp->expType = MkClassType(baseClass->fullName);
4865 {
4866 char constant[256];
4867
4868 sourceExp->type = 2;
4869 if(!strcmp(baseClass->dataTypeString, "int"))
4870 sprintf(constant, "%d", value->data);
4871 else
4872 sprintf(constant, "0x%X", value->data);
4873 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
4874 }
4875 while(converts.first)
4876 {
4877 struct Conversion * convert = converts.first;
4878
4879 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
4880 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
4881 }
4882 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
4883 return 0x1;
4884 }
4885 }
4886 }
4887 }
4888 if(converts.first)
4889 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
4890 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
4891 }
4892 }
4893 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)))
4894 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
4895 return 0x1;
4896 return 0x0;
4897 }
4898
4899 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
4900
4901 struct __ecereNameSpace__ecere__com__SubModule
4902 {
4903 struct __ecereNameSpace__ecere__com__SubModule * prev;
4904 struct __ecereNameSpace__ecere__com__SubModule * next;
4905 struct __ecereNameSpace__ecere__com__Instance * module;
4906 int importMode;
4907 } __attribute__ ((gcc_struct));
4908
4909 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
4910 {
4911 struct __ecereNameSpace__ecere__com__SubModule * subModule;
4912
4913 if(searchFor == searchIn)
4914 return 0x1;
4915 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->modules.first; subModule; subModule = subModule->next)
4916 {
4917 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->application)
4918 {
4919 if(ModuleVisibility(subModule->module, searchFor))
4920 return 0x1;
4921 }
4922 }
4923 return 0x0;
4924 }
4925
4926 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
4927
4928 struct __ecereNameSpace__ecere__com__Application
4929 {
4930 int argc;
4931 char * *  argv;
4932 int exitCode;
4933 unsigned int isGUIApp;
4934 struct __ecereNameSpace__ecere__sys__OldList allModules;
4935 char *  parsedCommand;
4936 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
4937 } __attribute__ ((gcc_struct));
4938
4939 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
4940 {
4941 struct __ecereNameSpace__ecere__com__Instance * module;
4942
4943 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 300)))->systemNameSpace, sourceExp, dest, string, conversions))
4944 return 0x1;
4945 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->privateNameSpace, sourceExp, dest, string, conversions))
4946 return 0x1;
4947 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
4948 return 0x1;
4949 for(module = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 300)))->allModules.first; module; module = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->next)
4950 {
4951 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
4952 return 0x1;
4953 }
4954 return 0x0;
4955 }
4956
4957 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
4958
4959 void ReadString(char *  output, char *  string);
4960
4961 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
4962
4963 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
4964
4965 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
4966
4967 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
4968 {
4969 void * __ecereTemp1;
4970 struct Type * source = sourceExp->expType;
4971 struct Type * realDest = dest;
4972
4973 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
4974 return 0x1;
4975 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
4976 {
4977 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
4978 {
4979 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4980
4981 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4982 ;
4983 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
4984 ;
4985 if(sourceBase == destBase)
4986 return 0x1;
4987 }
4988 }
4989 if(source)
4990 {
4991 struct __ecereNameSpace__ecere__sys__OldList * specs;
4992 unsigned int flag = 0x0;
4993 long long value = (((int)0x7fffffff));
4994
4995 source->refCount++;
4996 dest->refCount++;
4997 if(sourceExp->type == 2)
4998 {
4999 if(source->isSigned)
5000 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5001 else
5002 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5003 }
5004 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5005 {
5006 if(source->isSigned)
5007 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5008 else
5009 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5010 }
5011 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5012 {
5013 FreeType(source);
5014 source = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->isSigned = 0x0, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
5015 }
5016 if(dest->kind == 8)
5017 {
5018 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5019
5020 if(_class && _class->type == 3)
5021 {
5022 if(source->kind != 8)
5023 {
5024 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5025 struct Type * tempDest, * tempSource;
5026
5027 for(; _class->base->type != 1000; _class = _class->base)
5028 ;
5029 tempSource = dest;
5030 tempDest = tempType;
5031 tempType->kind = 8;
5032 if(!_class->symbol)
5033 _class->symbol = FindClass(_class->fullName);
5034 tempType->_class = _class->symbol;
5035 tempType->truth = dest->truth;
5036 if(tempType->_class)
5037 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5038 FreeType(sourceExp->expType);
5039 sourceExp->expType = dest;
5040 dest->refCount++;
5041 flag = 0x1;
5042 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5043 }
5044 }
5045 if(_class && _class->type == 2 && source->kind != 8)
5046 {
5047 if(!dest->_class->registered->dataType)
5048 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5049 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5050 {
5051 FreeType(source);
5052 FreeType(sourceExp->expType);
5053 source = sourceExp->expType = MkClassType(dest->_class->string);
5054 source->refCount++;
5055 }
5056 }
5057 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5058 {
5059 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5060 struct Declarator * decl;
5061 char string[1024];
5062
5063 ReadString(string, sourceExp->string);
5064 decl = SpecDeclFromString(string, specs, (((void *)0)));
5065 FreeExpContents(sourceExp);
5066 FreeType(sourceExp->expType);
5067 sourceExp->type = 26;
5068 sourceExp->_classExp.specifiers = specs;
5069 sourceExp->_classExp.decl = decl;
5070 sourceExp->expType = dest;
5071 dest->refCount++;
5072 FreeType(source);
5073 FreeType(dest);
5074 return 0x1;
5075 }
5076 }
5077 else if(source->kind == 8)
5078 {
5079 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5080
5081 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5082 {
5083 if(dest->kind != 8)
5084 {
5085 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5086 struct Type * tempDest, * tempSource;
5087
5088 if(!source->_class->registered->dataType)
5089 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5090 for(; _class->base->type != 1000; _class = _class->base)
5091 ;
5092 tempDest = source;
5093 tempSource = tempType;
5094 tempType->kind = 8;
5095 tempType->_class = FindClass(_class->fullName);
5096 tempType->truth = source->truth;
5097 tempType->classObjectType = source->classObjectType;
5098 if(tempType->_class)
5099 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5100 if(conversions->last)
5101 {
5102 ((struct Conversion *)conversions->last)->resultType = dest;
5103 dest->refCount++;
5104 }
5105 FreeType(sourceExp->expType);
5106 sourceExp->expType = MkClassType(_class->fullName);
5107 sourceExp->expType->truth = source->truth;
5108 sourceExp->expType->classObjectType = source->classObjectType;
5109 if(!sourceExp->destType)
5110 {
5111 FreeType(sourceExp->destType);
5112 sourceExp->destType = sourceExp->expType;
5113 if(sourceExp->expType)
5114 sourceExp->expType->refCount++;
5115 }
5116 if(!_class->dataType)
5117 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5118 FreeType(dest);
5119 dest = MkClassType(source->_class->string);
5120 dest->truth = source->truth;
5121 dest->classObjectType = source->classObjectType;
5122 FreeType(source);
5123 source = _class->dataType;
5124 source->refCount++;
5125 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5126 }
5127 }
5128 }
5129 if(!flag)
5130 {
5131 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5132 {
5133 FreeType(source);
5134 FreeType(dest);
5135 return 0x1;
5136 }
5137 }
5138 if(dest->kind == 8)
5139 {
5140 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5141
5142 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5143 {
5144 if(_class->type == 0 || _class->type == 5)
5145 {
5146 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5147
5148 *newExp = *sourceExp;
5149 if(sourceExp->destType)
5150 sourceExp->destType->refCount++;
5151 if(sourceExp->expType)
5152 sourceExp->expType->refCount++;
5153 sourceExp->type = 11;
5154 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5155 sourceExp->cast.exp = newExp;
5156 FreeType(sourceExp->expType);
5157 sourceExp->expType = (((void *)0));
5158 ProcessExpressionType(sourceExp);
5159 if(!inCompiler)
5160 {
5161 FreeType(sourceExp->expType);
5162 sourceExp->expType = dest;
5163 }
5164 FreeType(source);
5165 if(inCompiler)
5166 FreeType(dest);
5167 return 0x1;
5168 }
5169 if(!_class->dataType)
5170 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5171 FreeType(dest);
5172 dest = _class->dataType;
5173 dest->refCount++;
5174 }
5175 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5176 {
5177 specs = MkListOne(MkSpecifier(DOUBLE));
5178 }
5179 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5180 {
5181 specs = MkListOne(MkSpecifier(FLOAT));
5182 }
5183 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5184 {
5185 specs = MkList();
5186 if(!dest->isSigned)
5187 ListAdd(specs, MkSpecifier(UNSIGNED));
5188 ListAdd(specs, MkSpecifier(INT64));
5189 }
5190 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5191 {
5192 specs = MkList();
5193 if(!dest->isSigned)
5194 ListAdd(specs, MkSpecifier(UNSIGNED));
5195 ListAdd(specs, MkSpecifier(INT));
5196 }
5197 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5198 {
5199 specs = MkList();
5200 if(!dest->isSigned)
5201 ListAdd(specs, MkSpecifier(UNSIGNED));
5202 ListAdd(specs, MkSpecifier(SHORT));
5203 }
5204 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5205 {
5206 specs = MkList();
5207 if(!dest->isSigned)
5208 ListAdd(specs, MkSpecifier(UNSIGNED));
5209 ListAdd(specs, MkSpecifier(CHAR));
5210 }
5211 else
5212 {
5213 FreeType(source);
5214 FreeType(dest);
5215 return 0x0;
5216 }
5217 }
5218 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))
5219 {
5220 specs = MkListOne(MkSpecifier(DOUBLE));
5221 }
5222 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5223 {
5224 specs = MkListOne(MkSpecifier(FLOAT));
5225 }
5226 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)))
5227 {
5228 specs = MkList();
5229 if(!dest->isSigned)
5230 ListAdd(specs, MkSpecifier(UNSIGNED));
5231 ListAdd(specs, MkSpecifier(CHAR));
5232 }
5233 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)))))
5234 {
5235 specs = MkList();
5236 if(!dest->isSigned)
5237 ListAdd(specs, MkSpecifier(UNSIGNED));
5238 ListAdd(specs, MkSpecifier(SHORT));
5239 }
5240 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5241 {
5242 specs = MkList();
5243 if(!dest->isSigned)
5244 ListAdd(specs, MkSpecifier(UNSIGNED));
5245 ListAdd(specs, MkSpecifier(INT));
5246 }
5247 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5248 {
5249 specs = MkList();
5250 if(!dest->isSigned)
5251 ListAdd(specs, MkSpecifier(UNSIGNED));
5252 ListAdd(specs, MkSpecifier(INT64));
5253 }
5254 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5255 {
5256 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5257 }
5258 else
5259 {
5260 FreeType(source);
5261 FreeType(dest);
5262 return 0x0;
5263 }
5264 if(!flag)
5265 {
5266 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5267
5268 *newExp = *sourceExp;
5269 newExp->prev = (((void *)0));
5270 newExp->next = (((void *)0));
5271 if(sourceExp->destType)
5272 sourceExp->destType->refCount++;
5273 if(sourceExp->expType)
5274 sourceExp->expType->refCount++;
5275 sourceExp->type = 11;
5276 if(realDest->kind == 8)
5277 {
5278 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5279 FreeList(specs, FreeSpecifier);
5280 }
5281 else
5282 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5283 if(newExp->type == 4)
5284 {
5285 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5286 }
5287 else
5288 sourceExp->cast.exp = newExp;
5289 FreeType(sourceExp->expType);
5290 sourceExp->expType = (((void *)0));
5291 ProcessExpressionType(sourceExp);
5292 }
5293 else
5294 FreeList(specs, FreeSpecifier);
5295 FreeType(dest);
5296 FreeType(source);
5297 return 0x1;
5298 }
5299 else
5300 {
5301 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5302 sourceExp = (*sourceExp->list).last;
5303 if(sourceExp->type == 0)
5304 {
5305 struct Identifier * id = sourceExp->identifier;
5306
5307 if(dest->kind == 8)
5308 {
5309 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5310 {
5311 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5312 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5313
5314 if(enumClass)
5315 {
5316 for(; _class && _class->type == 4; _class = _class->base)
5317 {
5318 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5319 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5320
5321 for(value = e->values.first; value; value = value->next)
5322 {
5323 if(!strcmp(value->name, id->string))
5324 break;
5325 }
5326 if(value)
5327 {
5328 FreeExpContents(sourceExp);
5329 FreeType(sourceExp->expType);
5330 sourceExp->isConstant = 0x1;
5331 sourceExp->expType = MkClassType(_class->fullName);
5332 {
5333 char constant[256];
5334
5335 sourceExp->type = 2;
5336 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5337 sprintf(constant, "%d", value->data);
5338 else
5339 sprintf(constant, "0x%X", value->data);
5340 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5341 }
5342 return 0x1;
5343 }
5344 }
5345 }
5346 }
5347 }
5348 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5349 return 0x1;
5350 }
5351 }
5352 return 0x0;
5353 }
5354
5355 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5356 {
5357 int value2 = op2->i;
5358
5359 exp->type = 2;
5360 exp->string = PrintInt(op1->i + value2);
5361 if(!exp->expType)
5362 {
5363 exp->expType = op1->type;
5364 if(op1->type)
5365 op1->type->refCount++;
5366 }
5367 return 0x1;
5368 }
5369
5370 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5371 {
5372 unsigned int value2 = op2->ui;
5373
5374 exp->type = 2;
5375 exp->string = PrintUInt(op1->ui + value2);
5376 if(!exp->expType)
5377 {
5378 exp->expType = op1->type;
5379 if(op1->type)
5380 op1->type->refCount++;
5381 }
5382 return 0x1;
5383 }
5384
5385 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5386 {
5387 short value2 = op2->s;
5388
5389 exp->type = 2;
5390 exp->string = PrintShort(op1->s + value2);
5391 if(!exp->expType)
5392 {
5393 exp->expType = op1->type;
5394 if(op1->type)
5395 op1->type->refCount++;
5396 }
5397 return 0x1;
5398 }
5399
5400 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5401 {
5402 unsigned short value2 = op2->us;
5403
5404 exp->type = 2;
5405 exp->string = PrintUShort(op1->us + value2);
5406 if(!exp->expType)
5407 {
5408 exp->expType = op1->type;
5409 if(op1->type)
5410 op1->type->refCount++;
5411 }
5412 return 0x1;
5413 }
5414
5415 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5416 {
5417 char value2 = op2->c;
5418
5419 exp->type = 2;
5420 exp->string = PrintChar(op1->c + value2);
5421 if(!exp->expType)
5422 {
5423 exp->expType = op1->type;
5424 if(op1->type)
5425 op1->type->refCount++;
5426 }
5427 return 0x1;
5428 }
5429
5430 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5431 {
5432 unsigned char value2 = op2->uc;
5433
5434 exp->type = 2;
5435 exp->string = PrintUChar(op1->uc + value2);
5436 if(!exp->expType)
5437 {
5438 exp->expType = op1->type;
5439 if(op1->type)
5440 op1->type->refCount++;
5441 }
5442 return 0x1;
5443 }
5444
5445 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5446 {
5447 float value2 = op2->f;
5448
5449 exp->type = 2;
5450 exp->string = PrintFloat(op1->f + value2);
5451 if(!exp->expType)
5452 {
5453 exp->expType = op1->type;
5454 if(op1->type)
5455 op1->type->refCount++;
5456 }
5457 return 0x1;
5458 }
5459
5460 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5461 {
5462 double value2 = op2->d;
5463
5464 exp->type = 2;
5465 exp->string = PrintDouble(op1->d + value2);
5466 if(!exp->expType)
5467 {
5468 exp->expType = op1->type;
5469 if(op1->type)
5470 op1->type->refCount++;
5471 }
5472 return 0x1;
5473 }
5474
5475 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5476 {
5477 int value2 = op2->i;
5478
5479 exp->type = 2;
5480 exp->string = PrintInt(op1->i - value2);
5481 if(!exp->expType)
5482 {
5483 exp->expType = op1->type;
5484 if(op1->type)
5485 op1->type->refCount++;
5486 }
5487 return 0x1;
5488 }
5489
5490 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5491 {
5492 unsigned int value2 = op2->ui;
5493
5494 exp->type = 2;
5495 exp->string = PrintUInt(op1->ui - value2);
5496 if(!exp->expType)
5497 {
5498 exp->expType = op1->type;
5499 if(op1->type)
5500 op1->type->refCount++;
5501 }
5502 return 0x1;
5503 }
5504
5505 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5506 {
5507 short value2 = op2->s;
5508
5509 exp->type = 2;
5510 exp->string = PrintShort(op1->s - value2);
5511 if(!exp->expType)
5512 {
5513 exp->expType = op1->type;
5514 if(op1->type)
5515 op1->type->refCount++;
5516 }
5517 return 0x1;
5518 }
5519
5520 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5521 {
5522 unsigned short value2 = op2->us;
5523
5524 exp->type = 2;
5525 exp->string = PrintUShort(op1->us - value2);
5526 if(!exp->expType)
5527 {
5528 exp->expType = op1->type;
5529 if(op1->type)
5530 op1->type->refCount++;
5531 }
5532 return 0x1;
5533 }
5534
5535 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5536 {
5537 char value2 = op2->c;
5538
5539 exp->type = 2;
5540 exp->string = PrintChar(op1->c - value2);
5541 if(!exp->expType)
5542 {
5543 exp->expType = op1->type;
5544 if(op1->type)
5545 op1->type->refCount++;
5546 }
5547 return 0x1;
5548 }
5549
5550 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5551 {
5552 unsigned char value2 = op2->uc;
5553
5554 exp->type = 2;
5555 exp->string = PrintUChar(op1->uc - value2);
5556 if(!exp->expType)
5557 {
5558 exp->expType = op1->type;
5559 if(op1->type)
5560 op1->type->refCount++;
5561 }
5562 return 0x1;
5563 }
5564
5565 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5566 {
5567 float value2 = op2->f;
5568
5569 exp->type = 2;
5570 exp->string = PrintFloat(op1->f - value2);
5571 if(!exp->expType)
5572 {
5573 exp->expType = op1->type;
5574 if(op1->type)
5575 op1->type->refCount++;
5576 }
5577 return 0x1;
5578 }
5579
5580 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5581 {
5582 double value2 = op2->d;
5583
5584 exp->type = 2;
5585 exp->string = PrintDouble(op1->d - value2);
5586 if(!exp->expType)
5587 {
5588 exp->expType = op1->type;
5589 if(op1->type)
5590 op1->type->refCount++;
5591 }
5592 return 0x1;
5593 }
5594
5595 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5596 {
5597 int value2 = op2->i;
5598
5599 exp->type = 2;
5600 exp->string = PrintInt(op1->i * value2);
5601 if(!exp->expType)
5602 {
5603 exp->expType = op1->type;
5604 if(op1->type)
5605 op1->type->refCount++;
5606 }
5607 return 0x1;
5608 }
5609
5610 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5611 {
5612 unsigned int value2 = op2->ui;
5613
5614 exp->type = 2;
5615 exp->string = PrintUInt(op1->ui * value2);
5616 if(!exp->expType)
5617 {
5618 exp->expType = op1->type;
5619 if(op1->type)
5620 op1->type->refCount++;
5621 }
5622 return 0x1;
5623 }
5624
5625 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5626 {
5627 short value2 = op2->s;
5628
5629 exp->type = 2;
5630 exp->string = PrintShort(op1->s * value2);
5631 if(!exp->expType)
5632 {
5633 exp->expType = op1->type;
5634 if(op1->type)
5635 op1->type->refCount++;
5636 }
5637 return 0x1;
5638 }
5639
5640 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5641 {
5642 unsigned short value2 = op2->us;
5643
5644 exp->type = 2;
5645 exp->string = PrintUShort(op1->us * value2);
5646 if(!exp->expType)
5647 {
5648 exp->expType = op1->type;
5649 if(op1->type)
5650 op1->type->refCount++;
5651 }
5652 return 0x1;
5653 }
5654
5655 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5656 {
5657 char value2 = op2->c;
5658
5659 exp->type = 2;
5660 exp->string = PrintChar(op1->c * value2);
5661 if(!exp->expType)
5662 {
5663 exp->expType = op1->type;
5664 if(op1->type)
5665 op1->type->refCount++;
5666 }
5667 return 0x1;
5668 }
5669
5670 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5671 {
5672 unsigned char value2 = op2->uc;
5673
5674 exp->type = 2;
5675 exp->string = PrintUChar(op1->uc * value2);
5676 if(!exp->expType)
5677 {
5678 exp->expType = op1->type;
5679 if(op1->type)
5680 op1->type->refCount++;
5681 }
5682 return 0x1;
5683 }
5684
5685 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5686 {
5687 float value2 = op2->f;
5688
5689 exp->type = 2;
5690 exp->string = PrintFloat(op1->f * value2);
5691 if(!exp->expType)
5692 {
5693 exp->expType = op1->type;
5694 if(op1->type)
5695 op1->type->refCount++;
5696 }
5697 return 0x1;
5698 }
5699
5700 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5701 {
5702 double value2 = op2->d;
5703
5704 exp->type = 2;
5705 exp->string = PrintDouble(op1->d * value2);
5706 if(!exp->expType)
5707 {
5708 exp->expType = op1->type;
5709 if(op1->type)
5710 op1->type->refCount++;
5711 }
5712 return 0x1;
5713 }
5714
5715 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5716 {
5717 int value2 = op2->i;
5718
5719 exp->type = 2;
5720 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5721 if(!exp->expType)
5722 {
5723 exp->expType = op1->type;
5724 if(op1->type)
5725 op1->type->refCount++;
5726 }
5727 return 0x1;
5728 }
5729
5730 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5731 {
5732 unsigned int value2 = op2->ui;
5733
5734 exp->type = 2;
5735 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5736 if(!exp->expType)
5737 {
5738 exp->expType = op1->type;
5739 if(op1->type)
5740 op1->type->refCount++;
5741 }
5742 return 0x1;
5743 }
5744
5745 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5746 {
5747 short value2 = op2->s;
5748
5749 exp->type = 2;
5750 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
5751 if(!exp->expType)
5752 {
5753 exp->expType = op1->type;
5754 if(op1->type)
5755 op1->type->refCount++;
5756 }
5757 return 0x1;
5758 }
5759
5760 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5761 {
5762 unsigned short value2 = op2->us;
5763
5764 exp->type = 2;
5765 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
5766 if(!exp->expType)
5767 {
5768 exp->expType = op1->type;
5769 if(op1->type)
5770 op1->type->refCount++;
5771 }
5772 return 0x1;
5773 }
5774
5775 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5776 {
5777 char value2 = op2->c;
5778
5779 exp->type = 2;
5780 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
5781 if(!exp->expType)
5782 {
5783 exp->expType = op1->type;
5784 if(op1->type)
5785 op1->type->refCount++;
5786 }
5787 return 0x1;
5788 }
5789
5790 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5791 {
5792 unsigned char value2 = op2->uc;
5793
5794 exp->type = 2;
5795 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
5796 if(!exp->expType)
5797 {
5798 exp->expType = op1->type;
5799 if(op1->type)
5800 op1->type->refCount++;
5801 }
5802 return 0x1;
5803 }
5804
5805 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5806 {
5807 float value2 = op2->f;
5808
5809 exp->type = 2;
5810 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
5811 if(!exp->expType)
5812 {
5813 exp->expType = op1->type;
5814 if(op1->type)
5815 op1->type->refCount++;
5816 }
5817 return 0x1;
5818 }
5819
5820 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5821 {
5822 double value2 = op2->d;
5823
5824 exp->type = 2;
5825 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
5826 if(!exp->expType)
5827 {
5828 exp->expType = op1->type;
5829 if(op1->type)
5830 op1->type->refCount++;
5831 }
5832 return 0x1;
5833 }
5834
5835 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5836 {
5837 int value2 = op2->i;
5838
5839 exp->type = 2;
5840 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
5841 if(!exp->expType)
5842 {
5843 exp->expType = op1->type;
5844 if(op1->type)
5845 op1->type->refCount++;
5846 }
5847 return 0x1;
5848 }
5849
5850 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5851 {
5852 unsigned int value2 = op2->ui;
5853
5854 exp->type = 2;
5855 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
5856 if(!exp->expType)
5857 {
5858 exp->expType = op1->type;
5859 if(op1->type)
5860 op1->type->refCount++;
5861 }
5862 return 0x1;
5863 }
5864
5865 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5866 {
5867 short value2 = op2->s;
5868
5869 exp->type = 2;
5870 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
5871 if(!exp->expType)
5872 {
5873 exp->expType = op1->type;
5874 if(op1->type)
5875 op1->type->refCount++;
5876 }
5877 return 0x1;
5878 }
5879
5880 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5881 {
5882 unsigned short value2 = op2->us;
5883
5884 exp->type = 2;
5885 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
5886 if(!exp->expType)
5887 {
5888 exp->expType = op1->type;
5889 if(op1->type)
5890 op1->type->refCount++;
5891 }
5892 return 0x1;
5893 }
5894
5895 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5896 {
5897 char value2 = op2->c;
5898
5899 exp->type = 2;
5900 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
5901 if(!exp->expType)
5902 {
5903 exp->expType = op1->type;
5904 if(op1->type)
5905 op1->type->refCount++;
5906 }
5907 return 0x1;
5908 }
5909
5910 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5911 {
5912 unsigned char value2 = op2->uc;
5913
5914 exp->type = 2;
5915 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
5916 if(!exp->expType)
5917 {
5918 exp->expType = op1->type;
5919 if(op1->type)
5920 op1->type->refCount++;
5921 }
5922 return 0x1;
5923 }
5924
5925 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
5926 {
5927 exp->type = 2;
5928 exp->string = PrintInt(-op1->i);
5929 if(!exp->expType)
5930 {
5931 exp->expType = op1->type;
5932 if(op1->type)
5933 op1->type->refCount++;
5934 }
5935 return 0x1;
5936 }
5937
5938 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
5939 {
5940 exp->type = 2;
5941 exp->string = PrintUInt(-op1->ui);
5942 if(!exp->expType)
5943 {
5944 exp->expType = op1->type;
5945 if(op1->type)
5946 op1->type->refCount++;
5947 }
5948 return 0x1;
5949 }
5950
5951 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
5952 {
5953 exp->type = 2;
5954 exp->string = PrintShort(-op1->s);
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 UShortNeg(struct Expression * exp, struct Operand * op1)
5965 {
5966 exp->type = 2;
5967 exp->string = PrintUShort(-op1->us);
5968 if(!exp->expType)
5969 {
5970 exp->expType = op1->type;
5971 if(op1->type)
5972 op1->type->refCount++;
5973 }
5974 return 0x1;
5975 }
5976
5977 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
5978 {
5979 exp->type = 2;
5980 exp->string = PrintChar(-op1->c);
5981 if(!exp->expType)
5982 {
5983 exp->expType = op1->type;
5984 if(op1->type)
5985 op1->type->refCount++;
5986 }
5987 return 0x1;
5988 }
5989
5990 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
5991 {
5992 exp->type = 2;
5993 exp->string = PrintUChar(-op1->uc);
5994 if(!exp->expType)
5995 {
5996 exp->expType = op1->type;
5997 if(op1->type)
5998 op1->type->refCount++;
5999 }
6000 return 0x1;
6001 }
6002
6003 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6004 {
6005 exp->type = 2;
6006 exp->string = PrintFloat(-op1->f);
6007 if(!exp->expType)
6008 {
6009 exp->expType = op1->type;
6010 if(op1->type)
6011 op1->type->refCount++;
6012 }
6013 return 0x1;
6014 }
6015
6016 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6017 {
6018 exp->type = 2;
6019 exp->string = PrintDouble(-op1->d);
6020 if(!exp->expType)
6021 {
6022 exp->expType = op1->type;
6023 if(op1->type)
6024 op1->type->refCount++;
6025 }
6026 return 0x1;
6027 }
6028
6029 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6030 {
6031 exp->type = 2;
6032 exp->string = PrintInt(++op1->i);
6033 if(!exp->expType)
6034 {
6035 exp->expType = op1->type;
6036 if(op1->type)
6037 op1->type->refCount++;
6038 }
6039 return 0x1;
6040 }
6041
6042 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6043 {
6044 exp->type = 2;
6045 exp->string = PrintUInt(++op1->ui);
6046 if(!exp->expType)
6047 {
6048 exp->expType = op1->type;
6049 if(op1->type)
6050 op1->type->refCount++;
6051 }
6052 return 0x1;
6053 }
6054
6055 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6056 {
6057 exp->type = 2;
6058 exp->string = PrintShort(++op1->s);
6059 if(!exp->expType)
6060 {
6061 exp->expType = op1->type;
6062 if(op1->type)
6063 op1->type->refCount++;
6064 }
6065 return 0x1;
6066 }
6067
6068 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6069 {
6070 exp->type = 2;
6071 exp->string = PrintUShort(++op1->us);
6072 if(!exp->expType)
6073 {
6074 exp->expType = op1->type;
6075 if(op1->type)
6076 op1->type->refCount++;
6077 }
6078 return 0x1;
6079 }
6080
6081 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6082 {
6083 exp->type = 2;
6084 exp->string = PrintChar(++op1->c);
6085 if(!exp->expType)
6086 {
6087 exp->expType = op1->type;
6088 if(op1->type)
6089 op1->type->refCount++;
6090 }
6091 return 0x1;
6092 }
6093
6094 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6095 {
6096 exp->type = 2;
6097 exp->string = PrintUChar(++op1->uc);
6098 if(!exp->expType)
6099 {
6100 exp->expType = op1->type;
6101 if(op1->type)
6102 op1->type->refCount++;
6103 }
6104 return 0x1;
6105 }
6106
6107 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6108 {
6109 exp->type = 2;
6110 exp->string = PrintFloat(++op1->f);
6111 if(!exp->expType)
6112 {
6113 exp->expType = op1->type;
6114 if(op1->type)
6115 op1->type->refCount++;
6116 }
6117 return 0x1;
6118 }
6119
6120 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6121 {
6122 exp->type = 2;
6123 exp->string = PrintDouble(++op1->d);
6124 if(!exp->expType)
6125 {
6126 exp->expType = op1->type;
6127 if(op1->type)
6128 op1->type->refCount++;
6129 }
6130 return 0x1;
6131 }
6132
6133 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6134 {
6135 exp->type = 2;
6136 exp->string = PrintInt(--op1->i);
6137 if(!exp->expType)
6138 {
6139 exp->expType = op1->type;
6140 if(op1->type)
6141 op1->type->refCount++;
6142 }
6143 return 0x1;
6144 }
6145
6146 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6147 {
6148 exp->type = 2;
6149 exp->string = PrintUInt(--op1->ui);
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 ShortDec(struct Expression * exp, struct Operand * op1)
6160 {
6161 exp->type = 2;
6162 exp->string = PrintShort(--op1->s);
6163 if(!exp->expType)
6164 {
6165 exp->expType = op1->type;
6166 if(op1->type)
6167 op1->type->refCount++;
6168 }
6169 return 0x1;
6170 }
6171
6172 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6173 {
6174 exp->type = 2;
6175 exp->string = PrintUShort(--op1->us);
6176 if(!exp->expType)
6177 {
6178 exp->expType = op1->type;
6179 if(op1->type)
6180 op1->type->refCount++;
6181 }
6182 return 0x1;
6183 }
6184
6185 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6186 {
6187 exp->type = 2;
6188 exp->string = PrintChar(--op1->c);
6189 if(!exp->expType)
6190 {
6191 exp->expType = op1->type;
6192 if(op1->type)
6193 op1->type->refCount++;
6194 }
6195 return 0x1;
6196 }
6197
6198 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6199 {
6200 exp->type = 2;
6201 exp->string = PrintUChar(--op1->uc);
6202 if(!exp->expType)
6203 {
6204 exp->expType = op1->type;
6205 if(op1->type)
6206 op1->type->refCount++;
6207 }
6208 return 0x1;
6209 }
6210
6211 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6212 {
6213 exp->type = 2;
6214 exp->string = PrintFloat(--op1->f);
6215 if(!exp->expType)
6216 {
6217 exp->expType = op1->type;
6218 if(op1->type)
6219 op1->type->refCount++;
6220 }
6221 return 0x1;
6222 }
6223
6224 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6225 {
6226 exp->type = 2;
6227 exp->string = PrintDouble(--op1->d);
6228 if(!exp->expType)
6229 {
6230 exp->expType = op1->type;
6231 if(op1->type)
6232 op1->type->refCount++;
6233 }
6234 return 0x1;
6235 }
6236
6237 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6238 {
6239 int value2 = op2->i;
6240
6241 exp->type = 2;
6242 exp->string = PrintInt(op1->i = value2);
6243 if(!exp->expType)
6244 {
6245 exp->expType = op1->type;
6246 if(op1->type)
6247 op1->type->refCount++;
6248 }
6249 return 0x1;
6250 }
6251
6252 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6253 {
6254 unsigned int value2 = op2->ui;
6255
6256 exp->type = 2;
6257 exp->string = PrintUInt(op1->ui = value2);
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 ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6268 {
6269 short value2 = op2->s;
6270
6271 exp->type = 2;
6272 exp->string = PrintShort(op1->s = value2);
6273 if(!exp->expType)
6274 {
6275 exp->expType = op1->type;
6276 if(op1->type)
6277 op1->type->refCount++;
6278 }
6279 return 0x1;
6280 }
6281
6282 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6283 {
6284 unsigned short value2 = op2->us;
6285
6286 exp->type = 2;
6287 exp->string = PrintUShort(op1->us = value2);
6288 if(!exp->expType)
6289 {
6290 exp->expType = op1->type;
6291 if(op1->type)
6292 op1->type->refCount++;
6293 }
6294 return 0x1;
6295 }
6296
6297 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6298 {
6299 char value2 = op2->c;
6300
6301 exp->type = 2;
6302 exp->string = PrintChar(op1->c = value2);
6303 if(!exp->expType)
6304 {
6305 exp->expType = op1->type;
6306 if(op1->type)
6307 op1->type->refCount++;
6308 }
6309 return 0x1;
6310 }
6311
6312 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6313 {
6314 unsigned char value2 = op2->uc;
6315
6316 exp->type = 2;
6317 exp->string = PrintUChar(op1->uc = value2);
6318 if(!exp->expType)
6319 {
6320 exp->expType = op1->type;
6321 if(op1->type)
6322 op1->type->refCount++;
6323 }
6324 return 0x1;
6325 }
6326
6327 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6328 {
6329 float value2 = op2->f;
6330
6331 exp->type = 2;
6332 exp->string = PrintFloat(op1->f = value2);
6333 if(!exp->expType)
6334 {
6335 exp->expType = op1->type;
6336 if(op1->type)
6337 op1->type->refCount++;
6338 }
6339 return 0x1;
6340 }
6341
6342 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6343 {
6344 double value2 = op2->d;
6345
6346 exp->type = 2;
6347 exp->string = PrintDouble(op1->d = value2);
6348 if(!exp->expType)
6349 {
6350 exp->expType = op1->type;
6351 if(op1->type)
6352 op1->type->refCount++;
6353 }
6354 return 0x1;
6355 }
6356
6357 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6358 {
6359 int value2 = op2->i;
6360
6361 exp->type = 2;
6362 exp->string = PrintInt(op1->i += value2);
6363 if(!exp->expType)
6364 {
6365 exp->expType = op1->type;
6366 if(op1->type)
6367 op1->type->refCount++;
6368 }
6369 return 0x1;
6370 }
6371
6372 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6373 {
6374 unsigned int value2 = op2->ui;
6375
6376 exp->type = 2;
6377 exp->string = PrintUInt(op1->ui += value2);
6378 if(!exp->expType)
6379 {
6380 exp->expType = op1->type;
6381 if(op1->type)
6382 op1->type->refCount++;
6383 }
6384 return 0x1;
6385 }
6386
6387 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6388 {
6389 short value2 = op2->s;
6390
6391 exp->type = 2;
6392 exp->string = PrintShort(op1->s += value2);
6393 if(!exp->expType)
6394 {
6395 exp->expType = op1->type;
6396 if(op1->type)
6397 op1->type->refCount++;
6398 }
6399 return 0x1;
6400 }
6401
6402 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6403 {
6404 unsigned short value2 = op2->us;
6405
6406 exp->type = 2;
6407 exp->string = PrintUShort(op1->us += value2);
6408 if(!exp->expType)
6409 {
6410 exp->expType = op1->type;
6411 if(op1->type)
6412 op1->type->refCount++;
6413 }
6414 return 0x1;
6415 }
6416
6417 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6418 {
6419 char value2 = op2->c;
6420
6421 exp->type = 2;
6422 exp->string = PrintChar(op1->c += value2);
6423 if(!exp->expType)
6424 {
6425 exp->expType = op1->type;
6426 if(op1->type)
6427 op1->type->refCount++;
6428 }
6429 return 0x1;
6430 }
6431
6432 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6433 {
6434 unsigned char value2 = op2->uc;
6435
6436 exp->type = 2;
6437 exp->string = PrintUChar(op1->uc += value2);
6438 if(!exp->expType)
6439 {
6440 exp->expType = op1->type;
6441 if(op1->type)
6442 op1->type->refCount++;
6443 }
6444 return 0x1;
6445 }
6446
6447 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6448 {
6449 float value2 = op2->f;
6450
6451 exp->type = 2;
6452 exp->string = PrintFloat(op1->f += value2);
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 DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6463 {
6464 double value2 = op2->d;
6465
6466 exp->type = 2;
6467 exp->string = PrintDouble(op1->d += value2);
6468 if(!exp->expType)
6469 {
6470 exp->expType = op1->type;
6471 if(op1->type)
6472 op1->type->refCount++;
6473 }
6474 return 0x1;
6475 }
6476
6477 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6478 {
6479 int value2 = op2->i;
6480
6481 exp->type = 2;
6482 exp->string = PrintInt(op1->i -= value2);
6483 if(!exp->expType)
6484 {
6485 exp->expType = op1->type;
6486 if(op1->type)
6487 op1->type->refCount++;
6488 }
6489 return 0x1;
6490 }
6491
6492 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6493 {
6494 unsigned int value2 = op2->ui;
6495
6496 exp->type = 2;
6497 exp->string = PrintUInt(op1->ui -= value2);
6498 if(!exp->expType)
6499 {
6500 exp->expType = op1->type;
6501 if(op1->type)
6502 op1->type->refCount++;
6503 }
6504 return 0x1;
6505 }
6506
6507 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6508 {
6509 short value2 = op2->s;
6510
6511 exp->type = 2;
6512 exp->string = PrintShort(op1->s -= value2);
6513 if(!exp->expType)
6514 {
6515 exp->expType = op1->type;
6516 if(op1->type)
6517 op1->type->refCount++;
6518 }
6519 return 0x1;
6520 }
6521
6522 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6523 {
6524 unsigned short value2 = op2->us;
6525
6526 exp->type = 2;
6527 exp->string = PrintUShort(op1->us -= value2);
6528 if(!exp->expType)
6529 {
6530 exp->expType = op1->type;
6531 if(op1->type)
6532 op1->type->refCount++;
6533 }
6534 return 0x1;
6535 }
6536
6537 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6538 {
6539 char value2 = op2->c;
6540
6541 exp->type = 2;
6542 exp->string = PrintChar(op1->c -= value2);
6543 if(!exp->expType)
6544 {
6545 exp->expType = op1->type;
6546 if(op1->type)
6547 op1->type->refCount++;
6548 }
6549 return 0x1;
6550 }
6551
6552 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6553 {
6554 unsigned char value2 = op2->uc;
6555
6556 exp->type = 2;
6557 exp->string = PrintUChar(op1->uc -= value2);
6558 if(!exp->expType)
6559 {
6560 exp->expType = op1->type;
6561 if(op1->type)
6562 op1->type->refCount++;
6563 }
6564 return 0x1;
6565 }
6566
6567 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6568 {
6569 float value2 = op2->f;
6570
6571 exp->type = 2;
6572 exp->string = PrintFloat(op1->f -= value2);
6573 if(!exp->expType)
6574 {
6575 exp->expType = op1->type;
6576 if(op1->type)
6577 op1->type->refCount++;
6578 }
6579 return 0x1;
6580 }
6581
6582 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6583 {
6584 double value2 = op2->d;
6585
6586 exp->type = 2;
6587 exp->string = PrintDouble(op1->d -= value2);
6588 if(!exp->expType)
6589 {
6590 exp->expType = op1->type;
6591 if(op1->type)
6592 op1->type->refCount++;
6593 }
6594 return 0x1;
6595 }
6596
6597 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6598 {
6599 int value2 = op2->i;
6600
6601 exp->type = 2;
6602 exp->string = PrintInt(op1->i *= value2);
6603 if(!exp->expType)
6604 {
6605 exp->expType = op1->type;
6606 if(op1->type)
6607 op1->type->refCount++;
6608 }
6609 return 0x1;
6610 }
6611
6612 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6613 {
6614 unsigned int value2 = op2->ui;
6615
6616 exp->type = 2;
6617 exp->string = PrintUInt(op1->ui *= value2);
6618 if(!exp->expType)
6619 {
6620 exp->expType = op1->type;
6621 if(op1->type)
6622 op1->type->refCount++;
6623 }
6624 return 0x1;
6625 }
6626
6627 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6628 {
6629 short value2 = op2->s;
6630
6631 exp->type = 2;
6632 exp->string = PrintShort(op1->s *= value2);
6633 if(!exp->expType)
6634 {
6635 exp->expType = op1->type;
6636 if(op1->type)
6637 op1->type->refCount++;
6638 }
6639 return 0x1;
6640 }
6641
6642 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6643 {
6644 unsigned short value2 = op2->us;
6645
6646 exp->type = 2;
6647 exp->string = PrintUShort(op1->us *= value2);
6648 if(!exp->expType)
6649 {
6650 exp->expType = op1->type;
6651 if(op1->type)
6652 op1->type->refCount++;
6653 }
6654 return 0x1;
6655 }
6656
6657 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6658 {
6659 char value2 = op2->c;
6660
6661 exp->type = 2;
6662 exp->string = PrintChar(op1->c *= value2);
6663 if(!exp->expType)
6664 {
6665 exp->expType = op1->type;
6666 if(op1->type)
6667 op1->type->refCount++;
6668 }
6669 return 0x1;
6670 }
6671
6672 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6673 {
6674 unsigned char value2 = op2->uc;
6675
6676 exp->type = 2;
6677 exp->string = PrintUChar(op1->uc *= value2);
6678 if(!exp->expType)
6679 {
6680 exp->expType = op1->type;
6681 if(op1->type)
6682 op1->type->refCount++;
6683 }
6684 return 0x1;
6685 }
6686
6687 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6688 {
6689 float value2 = op2->f;
6690
6691 exp->type = 2;
6692 exp->string = PrintFloat(op1->f *= value2);
6693 if(!exp->expType)
6694 {
6695 exp->expType = op1->type;
6696 if(op1->type)
6697 op1->type->refCount++;
6698 }
6699 return 0x1;
6700 }
6701
6702 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6703 {
6704 double value2 = op2->d;
6705
6706 exp->type = 2;
6707 exp->string = PrintDouble(op1->d *= value2);
6708 if(!exp->expType)
6709 {
6710 exp->expType = op1->type;
6711 if(op1->type)
6712 op1->type->refCount++;
6713 }
6714 return 0x1;
6715 }
6716
6717 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6718 {
6719 int value2 = op2->i;
6720
6721 exp->type = 2;
6722 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6723 if(!exp->expType)
6724 {
6725 exp->expType = op1->type;
6726 if(op1->type)
6727 op1->type->refCount++;
6728 }
6729 return 0x1;
6730 }
6731
6732 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6733 {
6734 unsigned int value2 = op2->ui;
6735
6736 exp->type = 2;
6737 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
6738 if(!exp->expType)
6739 {
6740 exp->expType = op1->type;
6741 if(op1->type)
6742 op1->type->refCount++;
6743 }
6744 return 0x1;
6745 }
6746
6747 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6748 {
6749 short value2 = op2->s;
6750
6751 exp->type = 2;
6752 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
6753 if(!exp->expType)
6754 {
6755 exp->expType = op1->type;
6756 if(op1->type)
6757 op1->type->refCount++;
6758 }
6759 return 0x1;
6760 }
6761
6762 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6763 {
6764 unsigned short value2 = op2->us;
6765
6766 exp->type = 2;
6767 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
6768 if(!exp->expType)
6769 {
6770 exp->expType = op1->type;
6771 if(op1->type)
6772 op1->type->refCount++;
6773 }
6774 return 0x1;
6775 }
6776
6777 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6778 {
6779 char value2 = op2->c;
6780
6781 exp->type = 2;
6782 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
6783 if(!exp->expType)
6784 {
6785 exp->expType = op1->type;
6786 if(op1->type)
6787 op1->type->refCount++;
6788 }
6789 return 0x1;
6790 }
6791
6792 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6793 {
6794 unsigned char value2 = op2->uc;
6795
6796 exp->type = 2;
6797 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
6798 if(!exp->expType)
6799 {
6800 exp->expType = op1->type;
6801 if(op1->type)
6802 op1->type->refCount++;
6803 }
6804 return 0x1;
6805 }
6806
6807 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6808 {
6809 float value2 = op2->f;
6810
6811 exp->type = 2;
6812 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
6813 if(!exp->expType)
6814 {
6815 exp->expType = op1->type;
6816 if(op1->type)
6817 op1->type->refCount++;
6818 }
6819 return 0x1;
6820 }
6821
6822 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6823 {
6824 double value2 = op2->d;
6825
6826 exp->type = 2;
6827 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
6828 if(!exp->expType)
6829 {
6830 exp->expType = op1->type;
6831 if(op1->type)
6832 op1->type->refCount++;
6833 }
6834 return 0x1;
6835 }
6836
6837 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6838 {
6839 int value2 = op2->i;
6840
6841 exp->type = 2;
6842 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
6843 if(!exp->expType)
6844 {
6845 exp->expType = op1->type;
6846 if(op1->type)
6847 op1->type->refCount++;
6848 }
6849 return 0x1;
6850 }
6851
6852 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6853 {
6854 unsigned int value2 = op2->ui;
6855
6856 exp->type = 2;
6857 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
6858 if(!exp->expType)
6859 {
6860 exp->expType = op1->type;
6861 if(op1->type)
6862 op1->type->refCount++;
6863 }
6864 return 0x1;
6865 }
6866
6867 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6868 {
6869 short value2 = op2->s;
6870
6871 exp->type = 2;
6872 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
6873 if(!exp->expType)
6874 {
6875 exp->expType = op1->type;
6876 if(op1->type)
6877 op1->type->refCount++;
6878 }
6879 return 0x1;
6880 }
6881
6882 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6883 {
6884 unsigned short value2 = op2->us;
6885
6886 exp->type = 2;
6887 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
6888 if(!exp->expType)
6889 {
6890 exp->expType = op1->type;
6891 if(op1->type)
6892 op1->type->refCount++;
6893 }
6894 return 0x1;
6895 }
6896
6897 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6898 {
6899 char value2 = op2->c;
6900
6901 exp->type = 2;
6902 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
6903 if(!exp->expType)
6904 {
6905 exp->expType = op1->type;
6906 if(op1->type)
6907 op1->type->refCount++;
6908 }
6909 return 0x1;
6910 }
6911
6912 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6913 {
6914 unsigned char value2 = op2->uc;
6915
6916 exp->type = 2;
6917 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
6918 if(!exp->expType)
6919 {
6920 exp->expType = op1->type;
6921 if(op1->type)
6922 op1->type->refCount++;
6923 }
6924 return 0x1;
6925 }
6926
6927 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6928 {
6929 int value2 = op2->i;
6930
6931 exp->type = 2;
6932 exp->string = PrintInt(op1->i & value2);
6933 if(!exp->expType)
6934 {
6935 exp->expType = op1->type;
6936 if(op1->type)
6937 op1->type->refCount++;
6938 }
6939 return 0x1;
6940 }
6941
6942 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6943 {
6944 unsigned int value2 = op2->ui;
6945
6946 exp->type = 2;
6947 exp->string = PrintUInt(op1->ui & value2);
6948 if(!exp->expType)
6949 {
6950 exp->expType = op1->type;
6951 if(op1->type)
6952 op1->type->refCount++;
6953 }
6954 return 0x1;
6955 }
6956
6957 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6958 {
6959 short value2 = op2->s;
6960
6961 exp->type = 2;
6962 exp->string = PrintShort(op1->s & value2);
6963 if(!exp->expType)
6964 {
6965 exp->expType = op1->type;
6966 if(op1->type)
6967 op1->type->refCount++;
6968 }
6969 return 0x1;
6970 }
6971
6972 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6973 {
6974 unsigned short value2 = op2->us;
6975
6976 exp->type = 2;
6977 exp->string = PrintUShort(op1->us & value2);
6978 if(!exp->expType)
6979 {
6980 exp->expType = op1->type;
6981 if(op1->type)
6982 op1->type->refCount++;
6983 }
6984 return 0x1;
6985 }
6986
6987 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6988 {
6989 char value2 = op2->c;
6990
6991 exp->type = 2;
6992 exp->string = PrintChar(op1->c & value2);
6993 if(!exp->expType)
6994 {
6995 exp->expType = op1->type;
6996 if(op1->type)
6997 op1->type->refCount++;
6998 }
6999 return 0x1;
7000 }
7001
7002 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7003 {
7004 unsigned char value2 = op2->uc;
7005
7006 exp->type = 2;
7007 exp->string = PrintUChar(op1->uc & value2);
7008 if(!exp->expType)
7009 {
7010 exp->expType = op1->type;
7011 if(op1->type)
7012 op1->type->refCount++;
7013 }
7014 return 0x1;
7015 }
7016
7017 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7018 {
7019 int value2 = op2->i;
7020
7021 exp->type = 2;
7022 exp->string = PrintInt(op1->i | value2);
7023 if(!exp->expType)
7024 {
7025 exp->expType = op1->type;
7026 if(op1->type)
7027 op1->type->refCount++;
7028 }
7029 return 0x1;
7030 }
7031
7032 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7033 {
7034 unsigned int value2 = op2->ui;
7035
7036 exp->type = 2;
7037 exp->string = PrintUInt(op1->ui | value2);
7038 if(!exp->expType)
7039 {
7040 exp->expType = op1->type;
7041 if(op1->type)
7042 op1->type->refCount++;
7043 }
7044 return 0x1;
7045 }
7046
7047 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7048 {
7049 short value2 = op2->s;
7050
7051 exp->type = 2;
7052 exp->string = PrintShort(op1->s | value2);
7053 if(!exp->expType)
7054 {
7055 exp->expType = op1->type;
7056 if(op1->type)
7057 op1->type->refCount++;
7058 }
7059 return 0x1;
7060 }
7061
7062 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7063 {
7064 unsigned short value2 = op2->us;
7065
7066 exp->type = 2;
7067 exp->string = PrintUShort(op1->us | value2);
7068 if(!exp->expType)
7069 {
7070 exp->expType = op1->type;
7071 if(op1->type)
7072 op1->type->refCount++;
7073 }
7074 return 0x1;
7075 }
7076
7077 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7078 {
7079 char value2 = op2->c;
7080
7081 exp->type = 2;
7082 exp->string = PrintChar(op1->c | value2);
7083 if(!exp->expType)
7084 {
7085 exp->expType = op1->type;
7086 if(op1->type)
7087 op1->type->refCount++;
7088 }
7089 return 0x1;
7090 }
7091
7092 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7093 {
7094 unsigned char value2 = op2->uc;
7095
7096 exp->type = 2;
7097 exp->string = PrintUChar(op1->uc | value2);
7098 if(!exp->expType)
7099 {
7100 exp->expType = op1->type;
7101 if(op1->type)
7102 op1->type->refCount++;
7103 }
7104 return 0x1;
7105 }
7106
7107 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7108 {
7109 int value2 = op2->i;
7110
7111 exp->type = 2;
7112 exp->string = PrintInt(op1->i ^ value2);
7113 if(!exp->expType)
7114 {
7115 exp->expType = op1->type;
7116 if(op1->type)
7117 op1->type->refCount++;
7118 }
7119 return 0x1;
7120 }
7121
7122 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7123 {
7124 unsigned int value2 = op2->ui;
7125
7126 exp->type = 2;
7127 exp->string = PrintUInt(op1->ui ^ value2);
7128 if(!exp->expType)
7129 {
7130 exp->expType = op1->type;
7131 if(op1->type)
7132 op1->type->refCount++;
7133 }
7134 return 0x1;
7135 }
7136
7137 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7138 {
7139 short value2 = op2->s;
7140
7141 exp->type = 2;
7142 exp->string = PrintShort(op1->s ^ value2);
7143 if(!exp->expType)
7144 {
7145 exp->expType = op1->type;
7146 if(op1->type)
7147 op1->type->refCount++;
7148 }
7149 return 0x1;
7150 }
7151
7152 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7153 {
7154 unsigned short value2 = op2->us;
7155
7156 exp->type = 2;
7157 exp->string = PrintUShort(op1->us ^ value2);
7158 if(!exp->expType)
7159 {
7160 exp->expType = op1->type;
7161 if(op1->type)
7162 op1->type->refCount++;
7163 }
7164 return 0x1;
7165 }
7166
7167 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7168 {
7169 char value2 = op2->c;
7170
7171 exp->type = 2;
7172 exp->string = PrintChar(op1->c ^ value2);
7173 if(!exp->expType)
7174 {
7175 exp->expType = op1->type;
7176 if(op1->type)
7177 op1->type->refCount++;
7178 }
7179 return 0x1;
7180 }
7181
7182 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7183 {
7184 unsigned char value2 = op2->uc;
7185
7186 exp->type = 2;
7187 exp->string = PrintUChar(op1->uc ^ value2);
7188 if(!exp->expType)
7189 {
7190 exp->expType = op1->type;
7191 if(op1->type)
7192 op1->type->refCount++;
7193 }
7194 return 0x1;
7195 }
7196
7197 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7198 {
7199 int value2 = op2->i;
7200
7201 exp->type = 2;
7202 exp->string = PrintInt(op1->i << value2);
7203 if(!exp->expType)
7204 {
7205 exp->expType = op1->type;
7206 if(op1->type)
7207 op1->type->refCount++;
7208 }
7209 return 0x1;
7210 }
7211
7212 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7213 {
7214 unsigned int value2 = op2->ui;
7215
7216 exp->type = 2;
7217 exp->string = PrintUInt(op1->ui << value2);
7218 if(!exp->expType)
7219 {
7220 exp->expType = op1->type;
7221 if(op1->type)
7222 op1->type->refCount++;
7223 }
7224 return 0x1;
7225 }
7226
7227 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7228 {
7229 short value2 = op2->s;
7230
7231 exp->type = 2;
7232 exp->string = PrintShort(op1->s << value2);
7233 if(!exp->expType)
7234 {
7235 exp->expType = op1->type;
7236 if(op1->type)
7237 op1->type->refCount++;
7238 }
7239 return 0x1;
7240 }
7241
7242 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7243 {
7244 unsigned short value2 = op2->us;
7245
7246 exp->type = 2;
7247 exp->string = PrintUShort(op1->us << value2);
7248 if(!exp->expType)
7249 {
7250 exp->expType = op1->type;
7251 if(op1->type)
7252 op1->type->refCount++;
7253 }
7254 return 0x1;
7255 }
7256
7257 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7258 {
7259 char value2 = op2->c;
7260
7261 exp->type = 2;
7262 exp->string = PrintChar(op1->c << value2);
7263 if(!exp->expType)
7264 {
7265 exp->expType = op1->type;
7266 if(op1->type)
7267 op1->type->refCount++;
7268 }
7269 return 0x1;
7270 }
7271
7272 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7273 {
7274 unsigned char value2 = op2->uc;
7275
7276 exp->type = 2;
7277 exp->string = PrintUChar(op1->uc << value2);
7278 if(!exp->expType)
7279 {
7280 exp->expType = op1->type;
7281 if(op1->type)
7282 op1->type->refCount++;
7283 }
7284 return 0x1;
7285 }
7286
7287 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7288 {
7289 int value2 = op2->i;
7290
7291 exp->type = 2;
7292 exp->string = PrintInt(op1->i >> value2);
7293 if(!exp->expType)
7294 {
7295 exp->expType = op1->type;
7296 if(op1->type)
7297 op1->type->refCount++;
7298 }
7299 return 0x1;
7300 }
7301
7302 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7303 {
7304 unsigned int value2 = op2->ui;
7305
7306 exp->type = 2;
7307 exp->string = PrintUInt(op1->ui >> value2);
7308 if(!exp->expType)
7309 {
7310 exp->expType = op1->type;
7311 if(op1->type)
7312 op1->type->refCount++;
7313 }
7314 return 0x1;
7315 }
7316
7317 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7318 {
7319 short value2 = op2->s;
7320
7321 exp->type = 2;
7322 exp->string = PrintShort(op1->s >> value2);
7323 if(!exp->expType)
7324 {
7325 exp->expType = op1->type;
7326 if(op1->type)
7327 op1->type->refCount++;
7328 }
7329 return 0x1;
7330 }
7331
7332 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7333 {
7334 unsigned short value2 = op2->us;
7335
7336 exp->type = 2;
7337 exp->string = PrintUShort(op1->us >> value2);
7338 if(!exp->expType)
7339 {
7340 exp->expType = op1->type;
7341 if(op1->type)
7342 op1->type->refCount++;
7343 }
7344 return 0x1;
7345 }
7346
7347 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7348 {
7349 char value2 = op2->c;
7350
7351 exp->type = 2;
7352 exp->string = PrintChar(op1->c >> value2);
7353 if(!exp->expType)
7354 {
7355 exp->expType = op1->type;
7356 if(op1->type)
7357 op1->type->refCount++;
7358 }
7359 return 0x1;
7360 }
7361
7362 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7363 {
7364 unsigned char value2 = op2->uc;
7365
7366 exp->type = 2;
7367 exp->string = PrintUChar(op1->uc >> value2);
7368 if(!exp->expType)
7369 {
7370 exp->expType = op1->type;
7371 if(op1->type)
7372 op1->type->refCount++;
7373 }
7374 return 0x1;
7375 }
7376
7377 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7378 {
7379 exp->type = 2;
7380 exp->string = PrintInt(~op1->i);
7381 if(!exp->expType)
7382 {
7383 exp->expType = op1->type;
7384 if(op1->type)
7385 op1->type->refCount++;
7386 }
7387 return 0x1;
7388 }
7389
7390 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7391 {
7392 exp->type = 2;
7393 exp->string = PrintUInt(~op1->ui);
7394 if(!exp->expType)
7395 {
7396 exp->expType = op1->type;
7397 if(op1->type)
7398 op1->type->refCount++;
7399 }
7400 return 0x1;
7401 }
7402
7403 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7404 {
7405 exp->type = 2;
7406 exp->string = PrintShort(~op1->s);
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 UShortBitNot(struct Expression * exp, struct Operand * op1)
7417 {
7418 exp->type = 2;
7419 exp->string = PrintUShort(~op1->us);
7420 if(!exp->expType)
7421 {
7422 exp->expType = op1->type;
7423 if(op1->type)
7424 op1->type->refCount++;
7425 }
7426 return 0x1;
7427 }
7428
7429 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7430 {
7431 exp->type = 2;
7432 exp->string = PrintChar(~op1->c);
7433 if(!exp->expType)
7434 {
7435 exp->expType = op1->type;
7436 if(op1->type)
7437 op1->type->refCount++;
7438 }
7439 return 0x1;
7440 }
7441
7442 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7443 {
7444 exp->type = 2;
7445 exp->string = PrintUChar(~op1->uc);
7446 if(!exp->expType)
7447 {
7448 exp->expType = op1->type;
7449 if(op1->type)
7450 op1->type->refCount++;
7451 }
7452 return 0x1;
7453 }
7454
7455 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7456 {
7457 int value2 = op2->i;
7458
7459 exp->type = 2;
7460 exp->string = PrintInt(op1->i &= value2);
7461 if(!exp->expType)
7462 {
7463 exp->expType = op1->type;
7464 if(op1->type)
7465 op1->type->refCount++;
7466 }
7467 return 0x1;
7468 }
7469
7470 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7471 {
7472 unsigned int value2 = op2->ui;
7473
7474 exp->type = 2;
7475 exp->string = PrintUInt(op1->ui &= value2);
7476 if(!exp->expType)
7477 {
7478 exp->expType = op1->type;
7479 if(op1->type)
7480 op1->type->refCount++;
7481 }
7482 return 0x1;
7483 }
7484
7485 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7486 {
7487 short value2 = op2->s;
7488
7489 exp->type = 2;
7490 exp->string = PrintShort(op1->s &= value2);
7491 if(!exp->expType)
7492 {
7493 exp->expType = op1->type;
7494 if(op1->type)
7495 op1->type->refCount++;
7496 }
7497 return 0x1;
7498 }
7499
7500 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7501 {
7502 unsigned short value2 = op2->us;
7503
7504 exp->type = 2;
7505 exp->string = PrintUShort(op1->us &= value2);
7506 if(!exp->expType)
7507 {
7508 exp->expType = op1->type;
7509 if(op1->type)
7510 op1->type->refCount++;
7511 }
7512 return 0x1;
7513 }
7514
7515 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7516 {
7517 char value2 = op2->c;
7518
7519 exp->type = 2;
7520 exp->string = PrintChar(op1->c &= value2);
7521 if(!exp->expType)
7522 {
7523 exp->expType = op1->type;
7524 if(op1->type)
7525 op1->type->refCount++;
7526 }
7527 return 0x1;
7528 }
7529
7530 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7531 {
7532 unsigned char value2 = op2->uc;
7533
7534 exp->type = 2;
7535 exp->string = PrintUChar(op1->uc &= value2);
7536 if(!exp->expType)
7537 {
7538 exp->expType = op1->type;
7539 if(op1->type)
7540 op1->type->refCount++;
7541 }
7542 return 0x1;
7543 }
7544
7545 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7546 {
7547 int value2 = op2->i;
7548
7549 exp->type = 2;
7550 exp->string = PrintInt(op1->i |= value2);
7551 if(!exp->expType)
7552 {
7553 exp->expType = op1->type;
7554 if(op1->type)
7555 op1->type->refCount++;
7556 }
7557 return 0x1;
7558 }
7559
7560 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7561 {
7562 unsigned int value2 = op2->ui;
7563
7564 exp->type = 2;
7565 exp->string = PrintUInt(op1->ui |= value2);
7566 if(!exp->expType)
7567 {
7568 exp->expType = op1->type;
7569 if(op1->type)
7570 op1->type->refCount++;
7571 }
7572 return 0x1;
7573 }
7574
7575 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7576 {
7577 short value2 = op2->s;
7578
7579 exp->type = 2;
7580 exp->string = PrintShort(op1->s |= value2);
7581 if(!exp->expType)
7582 {
7583 exp->expType = op1->type;
7584 if(op1->type)
7585 op1->type->refCount++;
7586 }
7587 return 0x1;
7588 }
7589
7590 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7591 {
7592 unsigned short value2 = op2->us;
7593
7594 exp->type = 2;
7595 exp->string = PrintUShort(op1->us |= value2);
7596 if(!exp->expType)
7597 {
7598 exp->expType = op1->type;
7599 if(op1->type)
7600 op1->type->refCount++;
7601 }
7602 return 0x1;
7603 }
7604
7605 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7606 {
7607 char value2 = op2->c;
7608
7609 exp->type = 2;
7610 exp->string = PrintChar(op1->c |= value2);
7611 if(!exp->expType)
7612 {
7613 exp->expType = op1->type;
7614 if(op1->type)
7615 op1->type->refCount++;
7616 }
7617 return 0x1;
7618 }
7619
7620 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7621 {
7622 unsigned char value2 = op2->uc;
7623
7624 exp->type = 2;
7625 exp->string = PrintUChar(op1->uc |= value2);
7626 if(!exp->expType)
7627 {
7628 exp->expType = op1->type;
7629 if(op1->type)
7630 op1->type->refCount++;
7631 }
7632 return 0x1;
7633 }
7634
7635 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7636 {
7637 int value2 = op2->i;
7638
7639 exp->type = 2;
7640 exp->string = PrintInt(op1->i ^= value2);
7641 if(!exp->expType)
7642 {
7643 exp->expType = op1->type;
7644 if(op1->type)
7645 op1->type->refCount++;
7646 }
7647 return 0x1;
7648 }
7649
7650 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7651 {
7652 unsigned int value2 = op2->ui;
7653
7654 exp->type = 2;
7655 exp->string = PrintUInt(op1->ui ^= value2);
7656 if(!exp->expType)
7657 {
7658 exp->expType = op1->type;
7659 if(op1->type)
7660 op1->type->refCount++;
7661 }
7662 return 0x1;
7663 }
7664
7665 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7666 {
7667 short value2 = op2->s;
7668
7669 exp->type = 2;
7670 exp->string = PrintShort(op1->s ^= value2);
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 UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7681 {
7682 unsigned short value2 = op2->us;
7683
7684 exp->type = 2;
7685 exp->string = PrintUShort(op1->us ^= value2);
7686 if(!exp->expType)
7687 {
7688 exp->expType = op1->type;
7689 if(op1->type)
7690 op1->type->refCount++;
7691 }
7692 return 0x1;
7693 }
7694
7695 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7696 {
7697 char value2 = op2->c;
7698
7699 exp->type = 2;
7700 exp->string = PrintChar(op1->c ^= value2);
7701 if(!exp->expType)
7702 {
7703 exp->expType = op1->type;
7704 if(op1->type)
7705 op1->type->refCount++;
7706 }
7707 return 0x1;
7708 }
7709
7710 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7711 {
7712 unsigned char value2 = op2->uc;
7713
7714 exp->type = 2;
7715 exp->string = PrintUChar(op1->uc ^= value2);
7716 if(!exp->expType)
7717 {
7718 exp->expType = op1->type;
7719 if(op1->type)
7720 op1->type->refCount++;
7721 }
7722 return 0x1;
7723 }
7724
7725 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7726 {
7727 int value2 = op2->i;
7728
7729 exp->type = 2;
7730 exp->string = PrintInt(op1->i <<= value2);
7731 if(!exp->expType)
7732 {
7733 exp->expType = op1->type;
7734 if(op1->type)
7735 op1->type->refCount++;
7736 }
7737 return 0x1;
7738 }
7739
7740 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7741 {
7742 unsigned int value2 = op2->ui;
7743
7744 exp->type = 2;
7745 exp->string = PrintUInt(op1->ui <<= value2);
7746 if(!exp->expType)
7747 {
7748 exp->expType = op1->type;
7749 if(op1->type)
7750 op1->type->refCount++;
7751 }
7752 return 0x1;
7753 }
7754
7755 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7756 {
7757 short value2 = op2->s;
7758
7759 exp->type = 2;
7760 exp->string = PrintShort(op1->s <<= value2);
7761 if(!exp->expType)
7762 {
7763 exp->expType = op1->type;
7764 if(op1->type)
7765 op1->type->refCount++;
7766 }
7767 return 0x1;
7768 }
7769
7770 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7771 {
7772 unsigned short value2 = op2->us;
7773
7774 exp->type = 2;
7775 exp->string = PrintUShort(op1->us <<= value2);
7776 if(!exp->expType)
7777 {
7778 exp->expType = op1->type;
7779 if(op1->type)
7780 op1->type->refCount++;
7781 }
7782 return 0x1;
7783 }
7784
7785 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7786 {
7787 char value2 = op2->c;
7788
7789 exp->type = 2;
7790 exp->string = PrintChar(op1->c <<= value2);
7791 if(!exp->expType)
7792 {
7793 exp->expType = op1->type;
7794 if(op1->type)
7795 op1->type->refCount++;
7796 }
7797 return 0x1;
7798 }
7799
7800 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7801 {
7802 unsigned char value2 = op2->uc;
7803
7804 exp->type = 2;
7805 exp->string = PrintUChar(op1->uc <<= value2);
7806 if(!exp->expType)
7807 {
7808 exp->expType = op1->type;
7809 if(op1->type)
7810 op1->type->refCount++;
7811 }
7812 return 0x1;
7813 }
7814
7815 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7816 {
7817 int value2 = op2->i;
7818
7819 exp->type = 2;
7820 exp->string = PrintInt(op1->i >>= value2);
7821 if(!exp->expType)
7822 {
7823 exp->expType = op1->type;
7824 if(op1->type)
7825 op1->type->refCount++;
7826 }
7827 return 0x1;
7828 }
7829
7830 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7831 {
7832 unsigned int value2 = op2->ui;
7833
7834 exp->type = 2;
7835 exp->string = PrintUInt(op1->ui >>= value2);
7836 if(!exp->expType)
7837 {
7838 exp->expType = op1->type;
7839 if(op1->type)
7840 op1->type->refCount++;
7841 }
7842 return 0x1;
7843 }
7844
7845 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7846 {
7847 short value2 = op2->s;
7848
7849 exp->type = 2;
7850 exp->string = PrintShort(op1->s >>= value2);
7851 if(!exp->expType)
7852 {
7853 exp->expType = op1->type;
7854 if(op1->type)
7855 op1->type->refCount++;
7856 }
7857 return 0x1;
7858 }
7859
7860 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7861 {
7862 unsigned short value2 = op2->us;
7863
7864 exp->type = 2;
7865 exp->string = PrintUShort(op1->us >>= value2);
7866 if(!exp->expType)
7867 {
7868 exp->expType = op1->type;
7869 if(op1->type)
7870 op1->type->refCount++;
7871 }
7872 return 0x1;
7873 }
7874
7875 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7876 {
7877 char value2 = op2->c;
7878
7879 exp->type = 2;
7880 exp->string = PrintChar(op1->c >>= value2);
7881 if(!exp->expType)
7882 {
7883 exp->expType = op1->type;
7884 if(op1->type)
7885 op1->type->refCount++;
7886 }
7887 return 0x1;
7888 }
7889
7890 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7891 {
7892 unsigned char value2 = op2->uc;
7893
7894 exp->type = 2;
7895 exp->string = PrintUChar(op1->uc >>= value2);
7896 if(!exp->expType)
7897 {
7898 exp->expType = op1->type;
7899 if(op1->type)
7900 op1->type->refCount++;
7901 }
7902 return 0x1;
7903 }
7904
7905 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
7906 {
7907 exp->type = 2;
7908 exp->string = PrintInt(!op1->i);
7909 if(!exp->expType)
7910 {
7911 exp->expType = op1->type;
7912 if(op1->type)
7913 op1->type->refCount++;
7914 }
7915 return 0x1;
7916 }
7917
7918 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
7919 {
7920 exp->type = 2;
7921 exp->string = PrintUInt(!op1->ui);
7922 if(!exp->expType)
7923 {
7924 exp->expType = op1->type;
7925 if(op1->type)
7926 op1->type->refCount++;
7927 }
7928 return 0x1;
7929 }
7930
7931 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
7932 {
7933 exp->type = 2;
7934 exp->string = PrintShort(!op1->s);
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 UShortNot(struct Expression * exp, struct Operand * op1)
7945 {
7946 exp->type = 2;
7947 exp->string = PrintUShort(!op1->us);
7948 if(!exp->expType)
7949 {
7950 exp->expType = op1->type;
7951 if(op1->type)
7952 op1->type->refCount++;
7953 }
7954 return 0x1;
7955 }
7956
7957 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
7958 {
7959 exp->type = 2;
7960 exp->string = PrintChar(!op1->c);
7961 if(!exp->expType)
7962 {
7963 exp->expType = op1->type;
7964 if(op1->type)
7965 op1->type->refCount++;
7966 }
7967 return 0x1;
7968 }
7969
7970 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
7971 {
7972 exp->type = 2;
7973 exp->string = PrintUChar(!op1->uc);
7974 if(!exp->expType)
7975 {
7976 exp->expType = op1->type;
7977 if(op1->type)
7978 op1->type->refCount++;
7979 }
7980 return 0x1;
7981 }
7982
7983 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7984 {
7985 int value2 = op2->i;
7986
7987 exp->type = 2;
7988 exp->string = PrintInt(op1->i == value2);
7989 if(!exp->expType)
7990 {
7991 exp->expType = op1->type;
7992 if(op1->type)
7993 op1->type->refCount++;
7994 }
7995 return 0x1;
7996 }
7997
7998 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7999 {
8000 unsigned int value2 = op2->ui;
8001
8002 exp->type = 2;
8003 exp->string = PrintUInt(op1->ui == value2);
8004 if(!exp->expType)
8005 {
8006 exp->expType = op1->type;
8007 if(op1->type)
8008 op1->type->refCount++;
8009 }
8010 return 0x1;
8011 }
8012
8013 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8014 {
8015 short value2 = op2->s;
8016
8017 exp->type = 2;
8018 exp->string = PrintShort(op1->s == value2);
8019 if(!exp->expType)
8020 {
8021 exp->expType = op1->type;
8022 if(op1->type)
8023 op1->type->refCount++;
8024 }
8025 return 0x1;
8026 }
8027
8028 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8029 {
8030 unsigned short value2 = op2->us;
8031
8032 exp->type = 2;
8033 exp->string = PrintUShort(op1->us == value2);
8034 if(!exp->expType)
8035 {
8036 exp->expType = op1->type;
8037 if(op1->type)
8038 op1->type->refCount++;
8039 }
8040 return 0x1;
8041 }
8042
8043 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8044 {
8045 char value2 = op2->c;
8046
8047 exp->type = 2;
8048 exp->string = PrintChar(op1->c == value2);
8049 if(!exp->expType)
8050 {
8051 exp->expType = op1->type;
8052 if(op1->type)
8053 op1->type->refCount++;
8054 }
8055 return 0x1;
8056 }
8057
8058 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8059 {
8060 unsigned char value2 = op2->uc;
8061
8062 exp->type = 2;
8063 exp->string = PrintUChar(op1->uc == value2);
8064 if(!exp->expType)
8065 {
8066 exp->expType = op1->type;
8067 if(op1->type)
8068 op1->type->refCount++;
8069 }
8070 return 0x1;
8071 }
8072
8073 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8074 {
8075 float value2 = op2->f;
8076
8077 exp->type = 2;
8078 exp->string = PrintFloat(op1->f == value2);
8079 if(!exp->expType)
8080 {
8081 exp->expType = op1->type;
8082 if(op1->type)
8083 op1->type->refCount++;
8084 }
8085 return 0x1;
8086 }
8087
8088 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8089 {
8090 double value2 = op2->d;
8091
8092 exp->type = 2;
8093 exp->string = PrintDouble(op1->d == value2);
8094 if(!exp->expType)
8095 {
8096 exp->expType = op1->type;
8097 if(op1->type)
8098 op1->type->refCount++;
8099 }
8100 return 0x1;
8101 }
8102
8103 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8104 {
8105 int value2 = op2->i;
8106
8107 exp->type = 2;
8108 exp->string = PrintInt(op1->i != value2);
8109 if(!exp->expType)
8110 {
8111 exp->expType = op1->type;
8112 if(op1->type)
8113 op1->type->refCount++;
8114 }
8115 return 0x1;
8116 }
8117
8118 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8119 {
8120 unsigned int value2 = op2->ui;
8121
8122 exp->type = 2;
8123 exp->string = PrintUInt(op1->ui != value2);
8124 if(!exp->expType)
8125 {
8126 exp->expType = op1->type;
8127 if(op1->type)
8128 op1->type->refCount++;
8129 }
8130 return 0x1;
8131 }
8132
8133 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8134 {
8135 short value2 = op2->s;
8136
8137 exp->type = 2;
8138 exp->string = PrintShort(op1->s != value2);
8139 if(!exp->expType)
8140 {
8141 exp->expType = op1->type;
8142 if(op1->type)
8143 op1->type->refCount++;
8144 }
8145 return 0x1;
8146 }
8147
8148 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8149 {
8150 unsigned short value2 = op2->us;
8151
8152 exp->type = 2;
8153 exp->string = PrintUShort(op1->us != value2);
8154 if(!exp->expType)
8155 {
8156 exp->expType = op1->type;
8157 if(op1->type)
8158 op1->type->refCount++;
8159 }
8160 return 0x1;
8161 }
8162
8163 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8164 {
8165 char value2 = op2->c;
8166
8167 exp->type = 2;
8168 exp->string = PrintChar(op1->c != value2);
8169 if(!exp->expType)
8170 {
8171 exp->expType = op1->type;
8172 if(op1->type)
8173 op1->type->refCount++;
8174 }
8175 return 0x1;
8176 }
8177
8178 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8179 {
8180 unsigned char value2 = op2->uc;
8181
8182 exp->type = 2;
8183 exp->string = PrintUChar(op1->uc != value2);
8184 if(!exp->expType)
8185 {
8186 exp->expType = op1->type;
8187 if(op1->type)
8188 op1->type->refCount++;
8189 }
8190 return 0x1;
8191 }
8192
8193 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8194 {
8195 float value2 = op2->f;
8196
8197 exp->type = 2;
8198 exp->string = PrintFloat(op1->f != value2);
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 DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8209 {
8210 double value2 = op2->d;
8211
8212 exp->type = 2;
8213 exp->string = PrintDouble(op1->d != value2);
8214 if(!exp->expType)
8215 {
8216 exp->expType = op1->type;
8217 if(op1->type)
8218 op1->type->refCount++;
8219 }
8220 return 0x1;
8221 }
8222
8223 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8224 {
8225 int value2 = op2->i;
8226
8227 exp->type = 2;
8228 exp->string = PrintInt(op1->i && value2);
8229 if(!exp->expType)
8230 {
8231 exp->expType = op1->type;
8232 if(op1->type)
8233 op1->type->refCount++;
8234 }
8235 return 0x1;
8236 }
8237
8238 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8239 {
8240 unsigned int value2 = op2->ui;
8241
8242 exp->type = 2;
8243 exp->string = PrintUInt(op1->ui && value2);
8244 if(!exp->expType)
8245 {
8246 exp->expType = op1->type;
8247 if(op1->type)
8248 op1->type->refCount++;
8249 }
8250 return 0x1;
8251 }
8252
8253 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8254 {
8255 short value2 = op2->s;
8256
8257 exp->type = 2;
8258 exp->string = PrintShort(op1->s && value2);
8259 if(!exp->expType)
8260 {
8261 exp->expType = op1->type;
8262 if(op1->type)
8263 op1->type->refCount++;
8264 }
8265 return 0x1;
8266 }
8267
8268 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8269 {
8270 unsigned short value2 = op2->us;
8271
8272 exp->type = 2;
8273 exp->string = PrintUShort(op1->us && value2);
8274 if(!exp->expType)
8275 {
8276 exp->expType = op1->type;
8277 if(op1->type)
8278 op1->type->refCount++;
8279 }
8280 return 0x1;
8281 }
8282
8283 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8284 {
8285 char value2 = op2->c;
8286
8287 exp->type = 2;
8288 exp->string = PrintChar(op1->c && value2);
8289 if(!exp->expType)
8290 {
8291 exp->expType = op1->type;
8292 if(op1->type)
8293 op1->type->refCount++;
8294 }
8295 return 0x1;
8296 }
8297
8298 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8299 {
8300 unsigned char value2 = op2->uc;
8301
8302 exp->type = 2;
8303 exp->string = PrintUChar(op1->uc && value2);
8304 if(!exp->expType)
8305 {
8306 exp->expType = op1->type;
8307 if(op1->type)
8308 op1->type->refCount++;
8309 }
8310 return 0x1;
8311 }
8312
8313 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8314 {
8315 float value2 = op2->f;
8316
8317 exp->type = 2;
8318 exp->string = PrintFloat(op1->f && value2);
8319 if(!exp->expType)
8320 {
8321 exp->expType = op1->type;
8322 if(op1->type)
8323 op1->type->refCount++;
8324 }
8325 return 0x1;
8326 }
8327
8328 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8329 {
8330 double value2 = op2->d;
8331
8332 exp->type = 2;
8333 exp->string = PrintDouble(op1->d && value2);
8334 if(!exp->expType)
8335 {
8336 exp->expType = op1->type;
8337 if(op1->type)
8338 op1->type->refCount++;
8339 }
8340 return 0x1;
8341 }
8342
8343 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8344 {
8345 int value2 = op2->i;
8346
8347 exp->type = 2;
8348 exp->string = PrintInt(op1->i || value2);
8349 if(!exp->expType)
8350 {
8351 exp->expType = op1->type;
8352 if(op1->type)
8353 op1->type->refCount++;
8354 }
8355 return 0x1;
8356 }
8357
8358 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8359 {
8360 unsigned int value2 = op2->ui;
8361
8362 exp->type = 2;
8363 exp->string = PrintUInt(op1->ui || value2);
8364 if(!exp->expType)
8365 {
8366 exp->expType = op1->type;
8367 if(op1->type)
8368 op1->type->refCount++;
8369 }
8370 return 0x1;
8371 }
8372
8373 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8374 {
8375 short value2 = op2->s;
8376
8377 exp->type = 2;
8378 exp->string = PrintShort(op1->s || value2);
8379 if(!exp->expType)
8380 {
8381 exp->expType = op1->type;
8382 if(op1->type)
8383 op1->type->refCount++;
8384 }
8385 return 0x1;
8386 }
8387
8388 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8389 {
8390 unsigned short value2 = op2->us;
8391
8392 exp->type = 2;
8393 exp->string = PrintUShort(op1->us || value2);
8394 if(!exp->expType)
8395 {
8396 exp->expType = op1->type;
8397 if(op1->type)
8398 op1->type->refCount++;
8399 }
8400 return 0x1;
8401 }
8402
8403 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8404 {
8405 char value2 = op2->c;
8406
8407 exp->type = 2;
8408 exp->string = PrintChar(op1->c || value2);
8409 if(!exp->expType)
8410 {
8411 exp->expType = op1->type;
8412 if(op1->type)
8413 op1->type->refCount++;
8414 }
8415 return 0x1;
8416 }
8417
8418 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8419 {
8420 unsigned char value2 = op2->uc;
8421
8422 exp->type = 2;
8423 exp->string = PrintUChar(op1->uc || value2);
8424 if(!exp->expType)
8425 {
8426 exp->expType = op1->type;
8427 if(op1->type)
8428 op1->type->refCount++;
8429 }
8430 return 0x1;
8431 }
8432
8433 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8434 {
8435 float value2 = op2->f;
8436
8437 exp->type = 2;
8438 exp->string = PrintFloat(op1->f || value2);
8439 if(!exp->expType)
8440 {
8441 exp->expType = op1->type;
8442 if(op1->type)
8443 op1->type->refCount++;
8444 }
8445 return 0x1;
8446 }
8447
8448 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8449 {
8450 double value2 = op2->d;
8451
8452 exp->type = 2;
8453 exp->string = PrintDouble(op1->d || value2);
8454 if(!exp->expType)
8455 {
8456 exp->expType = op1->type;
8457 if(op1->type)
8458 op1->type->refCount++;
8459 }
8460 return 0x1;
8461 }
8462
8463 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8464 {
8465 int value2 = op2->i;
8466
8467 exp->type = 2;
8468 exp->string = PrintInt(op1->i > value2);
8469 if(!exp->expType)
8470 {
8471 exp->expType = op1->type;
8472 if(op1->type)
8473 op1->type->refCount++;
8474 }
8475 return 0x1;
8476 }
8477
8478 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8479 {
8480 unsigned int value2 = op2->ui;
8481
8482 exp->type = 2;
8483 exp->string = PrintUInt(op1->ui > value2);
8484 if(!exp->expType)
8485 {
8486 exp->expType = op1->type;
8487 if(op1->type)
8488 op1->type->refCount++;
8489 }
8490 return 0x1;
8491 }
8492
8493 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8494 {
8495 short value2 = op2->s;
8496
8497 exp->type = 2;
8498 exp->string = PrintShort(op1->s > value2);
8499 if(!exp->expType)
8500 {
8501 exp->expType = op1->type;
8502 if(op1->type)
8503 op1->type->refCount++;
8504 }
8505 return 0x1;
8506 }
8507
8508 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8509 {
8510 unsigned short value2 = op2->us;
8511
8512 exp->type = 2;
8513 exp->string = PrintUShort(op1->us > value2);
8514 if(!exp->expType)
8515 {
8516 exp->expType = op1->type;
8517 if(op1->type)
8518 op1->type->refCount++;
8519 }
8520 return 0x1;
8521 }
8522
8523 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8524 {
8525 char value2 = op2->c;
8526
8527 exp->type = 2;
8528 exp->string = PrintChar(op1->c > value2);
8529 if(!exp->expType)
8530 {
8531 exp->expType = op1->type;
8532 if(op1->type)
8533 op1->type->refCount++;
8534 }
8535 return 0x1;
8536 }
8537
8538 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8539 {
8540 unsigned char value2 = op2->uc;
8541
8542 exp->type = 2;
8543 exp->string = PrintUChar(op1->uc > value2);
8544 if(!exp->expType)
8545 {
8546 exp->expType = op1->type;
8547 if(op1->type)
8548 op1->type->refCount++;
8549 }
8550 return 0x1;
8551 }
8552
8553 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8554 {
8555 float value2 = op2->f;
8556
8557 exp->type = 2;
8558 exp->string = PrintFloat(op1->f > value2);
8559 if(!exp->expType)
8560 {
8561 exp->expType = op1->type;
8562 if(op1->type)
8563 op1->type->refCount++;
8564 }
8565 return 0x1;
8566 }
8567
8568 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8569 {
8570 double value2 = op2->d;
8571
8572 exp->type = 2;
8573 exp->string = PrintDouble(op1->d > value2);
8574 if(!exp->expType)
8575 {
8576 exp->expType = op1->type;
8577 if(op1->type)
8578 op1->type->refCount++;
8579 }
8580 return 0x1;
8581 }
8582
8583 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8584 {
8585 int value2 = op2->i;
8586
8587 exp->type = 2;
8588 exp->string = PrintInt(op1->i < value2);
8589 if(!exp->expType)
8590 {
8591 exp->expType = op1->type;
8592 if(op1->type)
8593 op1->type->refCount++;
8594 }
8595 return 0x1;
8596 }
8597
8598 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8599 {
8600 unsigned int value2 = op2->ui;
8601
8602 exp->type = 2;
8603 exp->string = PrintUInt(op1->ui < value2);
8604 if(!exp->expType)
8605 {
8606 exp->expType = op1->type;
8607 if(op1->type)
8608 op1->type->refCount++;
8609 }
8610 return 0x1;
8611 }
8612
8613 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8614 {
8615 short value2 = op2->s;
8616
8617 exp->type = 2;
8618 exp->string = PrintShort(op1->s < value2);
8619 if(!exp->expType)
8620 {
8621 exp->expType = op1->type;
8622 if(op1->type)
8623 op1->type->refCount++;
8624 }
8625 return 0x1;
8626 }
8627
8628 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8629 {
8630 unsigned short value2 = op2->us;
8631
8632 exp->type = 2;
8633 exp->string = PrintUShort(op1->us < value2);
8634 if(!exp->expType)
8635 {
8636 exp->expType = op1->type;
8637 if(op1->type)
8638 op1->type->refCount++;
8639 }
8640 return 0x1;
8641 }
8642
8643 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8644 {
8645 char value2 = op2->c;
8646
8647 exp->type = 2;
8648 exp->string = PrintChar(op1->c < value2);
8649 if(!exp->expType)
8650 {
8651 exp->expType = op1->type;
8652 if(op1->type)
8653 op1->type->refCount++;
8654 }
8655 return 0x1;
8656 }
8657
8658 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8659 {
8660 unsigned char value2 = op2->uc;
8661
8662 exp->type = 2;
8663 exp->string = PrintUChar(op1->uc < value2);
8664 if(!exp->expType)
8665 {
8666 exp->expType = op1->type;
8667 if(op1->type)
8668 op1->type->refCount++;
8669 }
8670 return 0x1;
8671 }
8672
8673 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8674 {
8675 float value2 = op2->f;
8676
8677 exp->type = 2;
8678 exp->string = PrintFloat(op1->f < value2);
8679 if(!exp->expType)
8680 {
8681 exp->expType = op1->type;
8682 if(op1->type)
8683 op1->type->refCount++;
8684 }
8685 return 0x1;
8686 }
8687
8688 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8689 {
8690 double value2 = op2->d;
8691
8692 exp->type = 2;
8693 exp->string = PrintDouble(op1->d < value2);
8694 if(!exp->expType)
8695 {
8696 exp->expType = op1->type;
8697 if(op1->type)
8698 op1->type->refCount++;
8699 }
8700 return 0x1;
8701 }
8702
8703 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8704 {
8705 int value2 = op2->i;
8706
8707 exp->type = 2;
8708 exp->string = PrintInt(op1->i >= value2);
8709 if(!exp->expType)
8710 {
8711 exp->expType = op1->type;
8712 if(op1->type)
8713 op1->type->refCount++;
8714 }
8715 return 0x1;
8716 }
8717
8718 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8719 {
8720 unsigned int value2 = op2->ui;
8721
8722 exp->type = 2;
8723 exp->string = PrintUInt(op1->ui >= value2);
8724 if(!exp->expType)
8725 {
8726 exp->expType = op1->type;
8727 if(op1->type)
8728 op1->type->refCount++;
8729 }
8730 return 0x1;
8731 }
8732
8733 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8734 {
8735 short value2 = op2->s;
8736
8737 exp->type = 2;
8738 exp->string = PrintShort(op1->s >= value2);
8739 if(!exp->expType)
8740 {
8741 exp->expType = op1->type;
8742 if(op1->type)
8743 op1->type->refCount++;
8744 }
8745 return 0x1;
8746 }
8747
8748 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8749 {
8750 unsigned short value2 = op2->us;
8751
8752 exp->type = 2;
8753 exp->string = PrintUShort(op1->us >= value2);
8754 if(!exp->expType)
8755 {
8756 exp->expType = op1->type;
8757 if(op1->type)
8758 op1->type->refCount++;
8759 }
8760 return 0x1;
8761 }
8762
8763 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8764 {
8765 char value2 = op2->c;
8766
8767 exp->type = 2;
8768 exp->string = PrintChar(op1->c >= value2);
8769 if(!exp->expType)
8770 {
8771 exp->expType = op1->type;
8772 if(op1->type)
8773 op1->type->refCount++;
8774 }
8775 return 0x1;
8776 }
8777
8778 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8779 {
8780 unsigned char value2 = op2->uc;
8781
8782 exp->type = 2;
8783 exp->string = PrintUChar(op1->uc >= value2);
8784 if(!exp->expType)
8785 {
8786 exp->expType = op1->type;
8787 if(op1->type)
8788 op1->type->refCount++;
8789 }
8790 return 0x1;
8791 }
8792
8793 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8794 {
8795 float value2 = op2->f;
8796
8797 exp->type = 2;
8798 exp->string = PrintFloat(op1->f >= value2);
8799 if(!exp->expType)
8800 {
8801 exp->expType = op1->type;
8802 if(op1->type)
8803 op1->type->refCount++;
8804 }
8805 return 0x1;
8806 }
8807
8808 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8809 {
8810 double value2 = op2->d;
8811
8812 exp->type = 2;
8813 exp->string = PrintDouble(op1->d >= value2);
8814 if(!exp->expType)
8815 {
8816 exp->expType = op1->type;
8817 if(op1->type)
8818 op1->type->refCount++;
8819 }
8820 return 0x1;
8821 }
8822
8823 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8824 {
8825 int value2 = op2->i;
8826
8827 exp->type = 2;
8828 exp->string = PrintInt(op1->i <= value2);
8829 if(!exp->expType)
8830 {
8831 exp->expType = op1->type;
8832 if(op1->type)
8833 op1->type->refCount++;
8834 }
8835 return 0x1;
8836 }
8837
8838 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8839 {
8840 unsigned int value2 = op2->ui;
8841
8842 exp->type = 2;
8843 exp->string = PrintUInt(op1->ui <= value2);
8844 if(!exp->expType)
8845 {
8846 exp->expType = op1->type;
8847 if(op1->type)
8848 op1->type->refCount++;
8849 }
8850 return 0x1;
8851 }
8852
8853 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8854 {
8855 short value2 = op2->s;
8856
8857 exp->type = 2;
8858 exp->string = PrintShort(op1->s <= value2);
8859 if(!exp->expType)
8860 {
8861 exp->expType = op1->type;
8862 if(op1->type)
8863 op1->type->refCount++;
8864 }
8865 return 0x1;
8866 }
8867
8868 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8869 {
8870 unsigned short value2 = op2->us;
8871
8872 exp->type = 2;
8873 exp->string = PrintUShort(op1->us <= value2);
8874 if(!exp->expType)
8875 {
8876 exp->expType = op1->type;
8877 if(op1->type)
8878 op1->type->refCount++;
8879 }
8880 return 0x1;
8881 }
8882
8883 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8884 {
8885 char value2 = op2->c;
8886
8887 exp->type = 2;
8888 exp->string = PrintChar(op1->c <= value2);
8889 if(!exp->expType)
8890 {
8891 exp->expType = op1->type;
8892 if(op1->type)
8893 op1->type->refCount++;
8894 }
8895 return 0x1;
8896 }
8897
8898 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8899 {
8900 unsigned char value2 = op2->uc;
8901
8902 exp->type = 2;
8903 exp->string = PrintUChar(op1->uc <= value2);
8904 if(!exp->expType)
8905 {
8906 exp->expType = op1->type;
8907 if(op1->type)
8908 op1->type->refCount++;
8909 }
8910 return 0x1;
8911 }
8912
8913 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8914 {
8915 float value2 = op2->f;
8916
8917 exp->type = 2;
8918 exp->string = PrintFloat(op1->f <= value2);
8919 if(!exp->expType)
8920 {
8921 exp->expType = op1->type;
8922 if(op1->type)
8923 op1->type->refCount++;
8924 }
8925 return 0x1;
8926 }
8927
8928 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8929 {
8930 double value2 = op2->d;
8931
8932 exp->type = 2;
8933 exp->string = PrintDouble(op1->d <= value2);
8934 if(!exp->expType)
8935 {
8936 exp->expType = op1->type;
8937 if(op1->type)
8938 op1->type->refCount++;
8939 }
8940 return 0x1;
8941 }
8942
8943 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8944 {
8945 exp->type = 2;
8946 exp->string = PrintInt(op1->i ? op2->i : op3->i);
8947 if(!exp->expType)
8948 {
8949 exp->expType = op1->type;
8950 if(op1->type)
8951 op1->type->refCount++;
8952 }
8953 return 0x1;
8954 }
8955
8956 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8957 {
8958 exp->type = 2;
8959 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
8960 if(!exp->expType)
8961 {
8962 exp->expType = op1->type;
8963 if(op1->type)
8964 op1->type->refCount++;
8965 }
8966 return 0x1;
8967 }
8968
8969 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8970 {
8971 exp->type = 2;
8972 exp->string = PrintShort(op1->s ? op2->s : op3->s);
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 UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8983 {
8984 exp->type = 2;
8985 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
8986 if(!exp->expType)
8987 {
8988 exp->expType = op1->type;
8989 if(op1->type)
8990 op1->type->refCount++;
8991 }
8992 return 0x1;
8993 }
8994
8995 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8996 {
8997 exp->type = 2;
8998 exp->string = PrintChar(op1->c ? op2->c : op3->c);
8999 if(!exp->expType)
9000 {
9001 exp->expType = op1->type;
9002 if(op1->type)
9003 op1->type->refCount++;
9004 }
9005 return 0x1;
9006 }
9007
9008 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9009 {
9010 exp->type = 2;
9011 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9012 if(!exp->expType)
9013 {
9014 exp->expType = op1->type;
9015 if(op1->type)
9016 op1->type->refCount++;
9017 }
9018 return 0x1;
9019 }
9020
9021 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9022 {
9023 exp->type = 2;
9024 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9025 if(!exp->expType)
9026 {
9027 exp->expType = op1->type;
9028 if(op1->type)
9029 op1->type->refCount++;
9030 }
9031 return 0x1;
9032 }
9033
9034 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9035 {
9036 exp->type = 2;
9037 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9038 if(!exp->expType)
9039 {
9040 exp->expType = op1->type;
9041 if(op1->type)
9042 op1->type->refCount++;
9043 }
9044 return 0x1;
9045 }
9046
9047 struct OpTable intOps = 
9048 {
9049 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
9050 };
9051
9052 struct OpTable uintOps = 
9053 {
9054 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
9055 };
9056
9057 struct OpTable shortOps = 
9058 {
9059 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
9060 };
9061
9062 struct OpTable ushortOps = 
9063 {
9064 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
9065 };
9066
9067 struct OpTable floatOps = 
9068 {
9069 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
9070 };
9071
9072 struct OpTable doubleOps = 
9073 {
9074 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
9075 };
9076
9077 struct OpTable charOps = 
9078 {
9079 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
9080 };
9081
9082 struct OpTable ucharOps = 
9083 {
9084 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
9085 };
9086
9087 void ReadString(char * output, char * string)
9088 {
9089 int len = strlen(string);
9090 int c, d = 0;
9091 unsigned int quoted = 0x0, escaped = 0x0;
9092
9093 for(c = 0; c < len; c++)
9094 {
9095 char ch = string[c];
9096
9097 if(escaped)
9098 {
9099 switch(ch)
9100 {
9101 case 'n':
9102 output[d] = '\n';
9103 break;
9104 case 't':
9105 output[d] = '\t';
9106 break;
9107 case 'a':
9108 output[d] = '\a';
9109 break;
9110 case 'b':
9111 output[d] = '\b';
9112 break;
9113 case 'f':
9114 output[d] = '\f';
9115 break;
9116 case 'r':
9117 output[d] = '\r';
9118 break;
9119 case 'v':
9120 output[d] = '\v';
9121 break;
9122 case '\\':
9123 output[d] = '\\';
9124 break;
9125 case '\"':
9126 output[d] = '\"';
9127 break;
9128 default:
9129 output[d++] = '\\';
9130 output[d] = ch;
9131 }
9132 d++;
9133 escaped = 0x0;
9134 }
9135 else
9136 {
9137 if(ch == '\"')
9138 quoted ^= 0x1;
9139 else if(quoted)
9140 {
9141 if(ch == '\\')
9142 escaped = 0x1;
9143 else
9144 output[d++] = ch;
9145 }
9146 }
9147 }
9148 output[d] = '\0';
9149 }
9150
9151 extern double strtod(char * , char * * );
9152
9153 struct Operand GetOperand(struct Expression * exp)
9154 {
9155 struct Operand op = 
9156 {
9157 0, 0, 0, 0, 
9158 {
9159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9160 }
9161 };
9162 struct Type * type = exp->expType;
9163
9164 if(type)
9165 {
9166 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9167 {
9168 if(!type->_class->registered->dataType)
9169 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9170 type = type->_class->registered->dataType;
9171 }
9172 op.kind = type->kind;
9173 op.type = exp->expType;
9174 if(exp->isConstant && exp->type == 2)
9175 {
9176 switch(op.kind)
9177 {
9178 case 1:
9179 {
9180 if(exp->constant[0] == '\'')
9181 op.c = exp->constant[1];
9182 else if(type->isSigned)
9183 {
9184 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9185 op.ops = charOps;
9186 }
9187 else
9188 {
9189 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9190 op.ops = ucharOps;
9191 }
9192 break;
9193 }
9194 case 2:
9195 if(type->isSigned)
9196 {
9197 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9198 op.ops = shortOps;
9199 }
9200 else
9201 {
9202 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9203 op.ops = ushortOps;
9204 }
9205 break;
9206 case 3:
9207 case 5:
9208 if(type->isSigned)
9209 {
9210 op.i = strtol(exp->constant, (((void *)0)), 0);
9211 op.ops = intOps;
9212 }
9213 else
9214 {
9215 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9216 op.ops = uintOps;
9217 }
9218 op.kind = 3;
9219 break;
9220 case 4:
9221 if(type->isSigned)
9222 {
9223 op.i64 = _strtoi64(exp->constant, (((void *)0)), 0);
9224 op.ops = intOps;
9225 }
9226 else
9227 {
9228 op.ui64 = _strtoui64(exp->constant, (((void *)0)), 0);
9229 op.ops = uintOps;
9230 }
9231 op.kind = 3;
9232 break;
9233 case 6:
9234 op.f = (float)strtod(exp->constant, (((void *)0)));
9235 op.ops = floatOps;
9236 break;
9237 case 7:
9238 op.d = (double)strtod(exp->constant, (((void *)0)));
9239 op.ops = doubleOps;
9240 break;
9241 case 12:
9242 case 13:
9243 case 8:
9244 op.p = (unsigned char *)strtoul(exp->constant, (((void *)0)), 0);
9245 op.kind = 13;
9246 op.ops = uintOps;
9247 break;
9248 }
9249 }
9250 }
9251 return op;
9252 }
9253
9254 int __ecereVMethodID_class_OnGetString;
9255
9256 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9257
9258 static void UnusedFunction()
9259 {
9260 int a;
9261
9262 ((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);
9263 }
9264
9265 extern int __ecereVMethodID_class_OnGetString;
9266
9267 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9268 {
9269 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9270
9271 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9272 {
9273 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9274 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9275 else
9276 {
9277 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9278 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9279 struct Type * type;
9280 void * ptr = inst->data + dataMember->offset + offset;
9281 char * result = (((void *)0));
9282
9283 exp->loc = member->loc = inst->loc;
9284 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9285 if(!dataMember->dataType)
9286 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9287 type = dataMember->dataType;
9288 if(type->kind == 8)
9289 {
9290 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9291
9292 if(_class->type == 4)
9293 {
9294 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9295
9296 if(enumClass)
9297 {
9298 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9299 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9300
9301 for(item = e->values.first; item; item = item->next)
9302 {
9303 if((int)item->data == *(int *)ptr)
9304 {
9305 result = item->name;
9306 break;
9307 }
9308 }
9309 if(result)
9310 {
9311 exp->identifier = MkIdentifier(result);
9312 exp->type = 0;
9313 exp->destType = MkClassType(_class->fullName);
9314 ProcessExpressionType(exp);
9315 }
9316 }
9317 }
9318 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9319 {
9320 if(!_class->dataType)
9321 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9322 type = _class->dataType;
9323 }
9324 }
9325 if(!result)
9326 {
9327 switch(type->kind)
9328 {
9329 case 6:
9330 {
9331 FreeExpContents(exp);
9332 exp->constant = PrintFloat(*(float *)ptr);
9333 exp->type = 2;
9334 break;
9335 }
9336 case 7:
9337 {
9338 FreeExpContents(exp);
9339 exp->constant = PrintDouble(*(double *)ptr);
9340 exp->type = 2;
9341 break;
9342 }
9343 case 3:
9344 {
9345 FreeExpContents(exp);
9346 exp->constant = PrintInt(*(int *)ptr);
9347 exp->type = 2;
9348 break;
9349 }
9350 case 4:
9351 {
9352 FreeExpContents(exp);
9353 exp->constant = PrintInt64(*(long long *)ptr);
9354 exp->type = 2;
9355 break;
9356 }
9357 default:
9358 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9359 }
9360 }
9361 ListAdd(memberList, member);
9362 }
9363 if(parentDataMember->type == 1)
9364 break;
9365 }
9366 }
9367
9368 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9369
9370 void PopulateInstance(struct Instantiation * inst)
9371 {
9372 struct Symbol * classSym = inst->_class->symbol;
9373 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9374 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9375 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9376
9377 inst->members = MkListOne(MkMembersInitList(memberList));
9378 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9379 {
9380 if(!dataMember->isProperty)
9381 {
9382 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9383 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9384 else
9385 {
9386 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9387 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9388 struct Type * type;
9389 void * ptr = inst->data + dataMember->offset;
9390 char * result = (((void *)0));
9391
9392 exp->loc = member->loc = inst->loc;
9393 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9394 if(!dataMember->dataType)
9395 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9396 type = dataMember->dataType;
9397 if(type->kind == 8)
9398 {
9399 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9400
9401 if(_class->type == 4)
9402 {
9403 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9404
9405 if(enumClass)
9406 {
9407 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9408 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9409
9410 for(item = e->values.first; item; item = item->next)
9411 {
9412 if((int)item->data == *(int *)ptr)
9413 {
9414 result = item->name;
9415 break;
9416 }
9417 }
9418 }
9419 if(result)
9420 {
9421 exp->identifier = MkIdentifier(result);
9422 exp->type = 0;
9423 exp->destType = MkClassType(_class->fullName);
9424 ProcessExpressionType(exp);
9425 }
9426 }
9427 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9428 {
9429 if(!_class->dataType)
9430 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9431 type = _class->dataType;
9432 }
9433 }
9434 if(!result)
9435 {
9436 switch(type->kind)
9437 {
9438 case 6:
9439 {
9440 exp->constant = PrintFloat(*(float *)ptr);
9441 exp->type = 2;
9442 break;
9443 }
9444 case 7:
9445 {
9446 exp->constant = PrintDouble(*(double *)ptr);
9447 exp->type = 2;
9448 break;
9449 }
9450 case 3:
9451 {
9452 exp->constant = PrintInt(*(int *)ptr);
9453 exp->type = 2;
9454 break;
9455 }
9456 case 4:
9457 {
9458 exp->constant = PrintInt64(*(long long *)ptr);
9459 exp->type = 2;
9460 break;
9461 }
9462 default:
9463 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9464 }
9465 }
9466 ListAdd(memberList, member);
9467 }
9468 }
9469 }
9470 }
9471
9472 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);
9473
9474 extern void FreeInstance(struct Instantiation * inst);
9475
9476 void ComputeInstantiation(struct Expression * exp)
9477 {
9478 struct Instantiation * inst = exp->instance;
9479 struct MembersInit * members;
9480 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9481 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9482 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9483 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9484 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9485 int subMemberStackPos = 0;
9486 uint64 bits = 0;
9487
9488 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9489 {
9490 if(inst->data)
9491 return ;
9492 if(_class->type == 0 || _class->type == 5)
9493 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9494 else
9495 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9496 }
9497 if(inst->members)
9498 {
9499 for(members = (*inst->members).first; members; members = members->next)
9500 {
9501 switch(members->type)
9502 {
9503 case 0:
9504 {
9505 if(members->dataMembers)
9506 {
9507 struct MemberInit * member;
9508
9509 for(member = (*members->dataMembers).first; member; member = member->next)
9510 {
9511 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9512 unsigned int found = 0x0;
9513 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9514 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9515 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9516 unsigned int dataMemberOffset;
9517
9518 if(!ident)
9519 {
9520 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9521 if(curMember)
9522 {
9523 if(curMember->isProperty)
9524 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9525 else
9526 {
9527 dataMember = curMember;
9528 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9529 }
9530 found = 0x1;
9531 }
9532 }
9533 else
9534 {
9535 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9536 if(prop)
9537 {
9538 found = 0x1;
9539 if(prop->memberAccess == 1)
9540 {
9541 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9542 curClass = prop->_class;
9543 }
9544 }
9545 else
9546 {
9547 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9548 int _subMemberStackPos = 0;
9549
9550 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9551 if(dataMember)
9552 {
9553 found = 0x1;
9554 if(dataMember->memberAccess == 1)
9555 {
9556 curMember = dataMember;
9557 curClass = dataMember->_class;
9558 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
9559 subMemberStackPos = _subMemberStackPos;
9560 }
9561 }
9562 }
9563 }
9564 if(found && member->initializer && member->initializer->type == 0)
9565 {
9566 struct Expression * value = member->initializer->exp;
9567 struct Type * type = (((void *)0));
9568
9569 if(prop)
9570 {
9571 type = prop->dataType;
9572 }
9573 else if(dataMember)
9574 {
9575 if(!dataMember->dataType)
9576 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9577 type = dataMember->dataType;
9578 }
9579 if(ident && ident->next)
9580 {
9581 for(ident = ident->next; ident && type; ident = ident->next)
9582 {
9583 if(type->kind == 8)
9584 {
9585 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9586 if(prop)
9587 type = prop->dataType;
9588 else
9589 {
9590 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9591 if(dataMember)
9592 type = dataMember->dataType;
9593 }
9594 }
9595 else if(type->kind == 9 || type->kind == 10)
9596 {
9597 struct Type * memberType;
9598
9599 for(memberType = type->members.first; memberType; memberType = memberType->next)
9600 {
9601 if(!strcmp(memberType->name, ident->string))
9602 {
9603 type = memberType;
9604 break;
9605 }
9606 }
9607 }
9608 }
9609 }
9610 if(value)
9611 {
9612 FreeType(value->destType);
9613 value->destType = type;
9614 if(type)
9615 type->refCount++;
9616 ComputeExpression(value);
9617 }
9618 if(value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9619 {
9620 if(type->kind == 8)
9621 {
9622 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9623
9624 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9625 {
9626 if(!_class->dataType)
9627 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9628 type = _class->dataType;
9629 }
9630 }
9631 if(dataMember)
9632 {
9633 void * ptr = inst->data + dataMemberOffset;
9634
9635 if(value->type == 2)
9636 {
9637 switch(type->kind)
9638 {
9639 case 3:
9640 {
9641 GetInt(value, (int *)ptr);
9642 break;
9643 }
9644 case 4:
9645 {
9646 GetInt64(value, (long long *)ptr);
9647 break;
9648 }
9649 case 6:
9650 {
9651 GetFloat(value, (float *)ptr);
9652 break;
9653 }
9654 case 7:
9655 {
9656 GetDouble(value, (double *)ptr);
9657 break;
9658 }
9659 }
9660 }
9661 else if(value->type == 1)
9662 {
9663 if(type->kind == 8)
9664 {
9665 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9666
9667 if(_class->type == 1)
9668 {
9669 ComputeTypeSize(type);
9670 if(value->instance->data)
9671 memcpy(ptr, value->instance->data, type->size);
9672 }
9673 }
9674 }
9675 }
9676 else if(prop)
9677 {
9678 if(value->type == 1 && value->instance->data)
9679 {
9680 void (* Set)(void *, void *) = (void *)prop->Set;
9681
9682 Set(inst->data, value->instance->data);
9683 PopulateInstance(inst);
9684 }
9685 else if(value->type == 2)
9686 {
9687 switch(type->kind)
9688 {
9689 case 7:
9690 {
9691 void (* Set)(void *, double) = (void *)prop->Set;
9692
9693 Set(inst->data, strtod(value->constant, (((void *)0))));
9694 break;
9695 }
9696 case 6:
9697 {
9698 void (* Set)(void *, float) = (void *)prop->Set;
9699
9700 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
9701 break;
9702 }
9703 case 3:
9704 {
9705 void (* Set)(void *, int) = (void *)prop->Set;
9706
9707 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
9708 break;
9709 }
9710 case 4:
9711 {
9712 void (* Set)(void *, long long) = (void *)prop->Set;
9713
9714 Set(inst->data, _strtoi64(value->constant, (((void *)0)), 0));
9715 break;
9716 }
9717 }
9718 }
9719 else if(value->type == 3)
9720 {
9721 char temp[1024];
9722
9723 ReadString(temp, value->string);
9724 prop->Set(inst->data, temp);
9725 }
9726 }
9727 }
9728 else if(_class->type == 3)
9729 {
9730 if(prop)
9731 {
9732 if(value->type == 2)
9733 {
9734 if(type->kind == 8)
9735 {
9736 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9737
9738 if(_class->type == 3)
9739 {
9740 if(!_class->dataType)
9741 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9742 type = _class->dataType;
9743 }
9744 }
9745 switch(type->kind)
9746 {
9747 case 6:
9748 {
9749 float fValue;
9750 float (* Set)(float) = (void *)prop->Set;
9751
9752 GetFloat(member->initializer->exp, &fValue);
9753 exp->constant = PrintFloat(Set(fValue));
9754 exp->type = 2;
9755 break;
9756 }
9757 case 7:
9758 {
9759 double dValue;
9760 double (* Set)(double) = (void *)prop->Set;
9761
9762 GetDouble(member->initializer->exp, &dValue);
9763 exp->constant = PrintDouble(Set(dValue));
9764 exp->type = 2;
9765 break;
9766 }
9767 }
9768 }
9769 }
9770 }
9771 else if(_class->type == 2)
9772 {
9773 if(prop)
9774 {
9775 if(value->type == 1 && value->instance->data)
9776 {
9777 unsigned int (* Set)(void *) = (void *)prop->Set;
9778
9779 bits = Set(value->instance->data);
9780 }
9781 else if(value->type == 2)
9782 {
9783 }
9784 }
9785 else if(dataMember)
9786 {
9787 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
9788 struct Type * type;
9789 int part = 0;
9790
9791 GetInt(value, &part);
9792 bits = (bits & ~bitMember->mask);
9793 if(!bitMember->dataType)
9794 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
9795 type = bitMember->dataType;
9796 if(type->kind == 8 && type->_class && type->_class->registered)
9797 {
9798 if(!type->_class->registered->dataType)
9799 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9800 type = type->_class->registered->dataType;
9801 }
9802 switch(type->kind)
9803 {
9804 case 1:
9805 if(type->isSigned)
9806 bits |= ((char)part << bitMember->pos);
9807 else
9808 bits |= ((unsigned char)part << bitMember->pos);
9809 break;
9810 case 2:
9811 if(type->isSigned)
9812 bits |= ((short)part << bitMember->pos);
9813 else
9814 bits |= ((unsigned short)part << bitMember->pos);
9815 break;
9816 case 3:
9817 case 5:
9818 if(type->isSigned)
9819 bits |= (part << bitMember->pos);
9820 else
9821 bits |= ((unsigned int)part << bitMember->pos);
9822 break;
9823 case 4:
9824 if(type->isSigned)
9825 bits |= ((long long)part << bitMember->pos);
9826 else
9827 bits |= ((uint64)part << bitMember->pos);
9828 break;
9829 }
9830 }
9831 }
9832 }
9833 else
9834 {
9835 if(_class && _class->type == 3)
9836 {
9837 ComputeExpression(member->initializer->exp);
9838 exp->constant = member->initializer->exp->constant;
9839 exp->type = 2;
9840 member->initializer->exp->constant = (((void *)0));
9841 }
9842 }
9843 }
9844 }
9845 break;
9846 }
9847 }
9848 }
9849 }
9850 if(_class && _class->type == 2)
9851 {
9852 exp->constant = PrintHexUInt(bits);
9853 exp->type = 2;
9854 }
9855 if(exp->type != 1)
9856 {
9857 FreeInstance(inst);
9858 }
9859 }
9860
9861 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
9862 {
9863 if(exp->op.op == SIZEOF)
9864 {
9865 FreeExpContents(exp);
9866 exp->type = 2;
9867 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
9868 }
9869 else
9870 {
9871 if(!exp->op.exp1)
9872 {
9873 switch(exp->op.op)
9874 {
9875 case '+':
9876 {
9877 struct Expression * exp2 = exp->op.exp2;
9878
9879 exp->op.exp2 = (((void *)0));
9880 FreeExpContents(exp);
9881 FreeType(exp->expType);
9882 FreeType(exp->destType);
9883 *exp = *exp2;
9884 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
9885 break;
9886 }
9887 case '-':
9888 if(op1->ops.Neg)
9889 {
9890 FreeExpContents(exp);
9891 op1->ops.Neg(exp, op1);
9892 }
9893 break;
9894 case '~':
9895 if(op1->ops.BitNot)
9896 {
9897 FreeExpContents(exp);
9898 op1->ops.BitNot(exp, op1);
9899 }
9900 break;
9901 case '!':
9902 if(op1->ops.Not)
9903 {
9904 FreeExpContents(exp);
9905 op1->ops.Not(exp, op1);
9906 }
9907 break;
9908 }
9909 }
9910 else
9911 {
9912 switch(exp->op.op)
9913 {
9914 case '+':
9915 if(op1->ops.Add)
9916 {
9917 FreeExpContents(exp);
9918 op1->ops.Add(exp, op1, op2);
9919 }
9920 break;
9921 case '-':
9922 if(op1->ops.Sub)
9923 {
9924 FreeExpContents(exp);
9925 op1->ops.Sub(exp, op1, op2);
9926 }
9927 break;
9928 case '*':
9929 if(op1->ops.Mul)
9930 {
9931 FreeExpContents(exp);
9932 op1->ops.Mul(exp, op1, op2);
9933 }
9934 break;
9935 case '/':
9936 if(op1->ops.Div)
9937 {
9938 FreeExpContents(exp);
9939 op1->ops.Div(exp, op1, op2);
9940 }
9941 break;
9942 case '%':
9943 if(op1->ops.Mod)
9944 {
9945 FreeExpContents(exp);
9946 op1->ops.Mod(exp, op1, op2);
9947 }
9948 break;
9949 case '&':
9950 if(exp->op.exp2)
9951 {
9952 if(op1->ops.BitAnd)
9953 {
9954 FreeExpContents(exp);
9955 op1->ops.BitAnd(exp, op1, op2);
9956 }
9957 }
9958 break;
9959 case '|':
9960 if(op1->ops.BitOr)
9961 {
9962 FreeExpContents(exp);
9963 op1->ops.BitOr(exp, op1, op2);
9964 }
9965 break;
9966 case '^':
9967 if(op1->ops.BitXor)
9968 {
9969 FreeExpContents(exp);
9970 op1->ops.BitXor(exp, op1, op2);
9971 }
9972 break;
9973 case LEFT_OP:
9974 if(op1->ops.LShift)
9975 {
9976 FreeExpContents(exp);
9977 op1->ops.LShift(exp, op1, op2);
9978 }
9979 break;
9980 case RIGHT_OP:
9981 if(op1->ops.RShift)
9982 {
9983 FreeExpContents(exp);
9984 op1->ops.RShift(exp, op1, op2);
9985 }
9986 break;
9987 case EQ_OP:
9988 if(op1->ops.Equ)
9989 {
9990 FreeExpContents(exp);
9991 op1->ops.Equ(exp, op1, op2);
9992 }
9993 break;
9994 case NE_OP:
9995 if(op1->ops.Nqu)
9996 {
9997 FreeExpContents(exp);
9998 op1->ops.Nqu(exp, op1, op2);
9999 }
10000 break;
10001 case AND_OP:
10002 if(op1->ops.And)
10003 {
10004 FreeExpContents(exp);
10005 op1->ops.And(exp, op1, op2);
10006 }
10007 break;
10008 case OR_OP:
10009 if(op1->ops.Or)
10010 {
10011 FreeExpContents(exp);
10012 op1->ops.Or(exp, op1, op2);
10013 }
10014 break;
10015 case '>':
10016 if(op1->ops.Grt)
10017 {
10018 FreeExpContents(exp);
10019 op1->ops.Grt(exp, op1, op2);
10020 }
10021 break;
10022 case '<':
10023 if(op1->ops.Sma)
10024 {
10025 FreeExpContents(exp);
10026 op1->ops.Sma(exp, op1, op2);
10027 }
10028 break;
10029 case GE_OP:
10030 if(op1->ops.GrtEqu)
10031 {
10032 FreeExpContents(exp);
10033 op1->ops.GrtEqu(exp, op1, op2);
10034 }
10035 break;
10036 case LE_OP:
10037 if(op1->ops.SmaEqu)
10038 {
10039 FreeExpContents(exp);
10040 op1->ops.SmaEqu(exp, op1, op2);
10041 }
10042 break;
10043 }
10044 }
10045 }
10046 }
10047
10048 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10049
10050 void ComputeExpression(struct Expression * exp)
10051 {
10052 char expString[10240];
10053
10054 expString[0] = '\0';
10055 switch(exp->type)
10056 {
10057 case 1:
10058 {
10059 ComputeInstantiation(exp);
10060 break;
10061 }
10062 case 4:
10063 {
10064 struct Expression * exp1, * exp2 = (((void *)0));
10065 struct Operand op1 = 
10066 {
10067 0, 0, 0, 0, 
10068 {
10069 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10070 }
10071 };
10072 struct Operand op2 = 
10073 {
10074 0, 0, 0, 0, 
10075 {
10076 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10077 }
10078 };
10079
10080 if(exp->op.exp2)
10081 ComputeExpression(exp->op.exp2);
10082 if(exp->op.exp1)
10083 {
10084 ComputeExpression(exp->op.exp1);
10085 exp1 = exp->op.exp1;
10086 exp2 = exp->op.exp2;
10087 op1 = GetOperand(exp1);
10088 if(op1.type)
10089 op1.type->refCount++;
10090 if(exp2)
10091 {
10092 op2 = GetOperand(exp2);
10093 if(op2.type)
10094 op2.type->refCount++;
10095 }
10096 }
10097 else
10098 {
10099 exp1 = exp->op.exp2;
10100 op1 = GetOperand(exp1);
10101 if(op1.type)
10102 op1.type->refCount++;
10103 }
10104 CallOperator(exp, exp1, exp2, &op1, &op2);
10105 if(op1.type)
10106 FreeType(op1.type);
10107 if(op2.type)
10108 FreeType(op2.type);
10109 break;
10110 }
10111 case 5:
10112 case 34:
10113 {
10114 struct Expression * e, * n;
10115
10116 for(e = (*exp->list).first; e; e = n)
10117 {
10118 n = e->next;
10119 if(!n)
10120 {
10121 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10122
10123 ComputeExpression(e);
10124 FreeType(exp->expType);
10125 FreeType(exp->destType);
10126 *exp = *e;
10127 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10128 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10129 }
10130 else
10131 {
10132 FreeExpression(e);
10133 }
10134 }
10135 break;
10136 }
10137 case 8:
10138 {
10139 struct Expression * memberExp = exp->member.exp;
10140 struct Identifier * memberID = exp->member.member;
10141 struct Type * type;
10142
10143 ComputeExpression(exp->member.exp);
10144 type = exp->member.exp->expType;
10145 if(type)
10146 {
10147 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)));
10148 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10149 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10150 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10151
10152 if(type->kind == 19 && exp->member.exp->type == 26)
10153 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10154 if(!_class)
10155 {
10156 char string[256];
10157 struct Symbol * classSym;
10158
10159 string[0] = '\0';
10160 PrintType(type, string, 0x0, 0x1);
10161 classSym = FindClass(string);
10162 _class = classSym ? classSym->registered : (((void *)0));
10163 }
10164 if(exp->member.member)
10165 {
10166 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10167 if(!prop)
10168 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10169 }
10170 if(!prop && !member && _class && exp->member.member)
10171 {
10172 struct Symbol * classSym = FindClass(exp->member.member->string);
10173
10174 convertTo = _class;
10175 _class = classSym ? classSym->registered : (((void *)0));
10176 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10177 }
10178 if(prop)
10179 {
10180 if(prop->compiled)
10181 {
10182 struct Type * type = prop->dataType;
10183
10184 if(_class->type == 3)
10185 {
10186 if(type->kind == 8)
10187 {
10188 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10189
10190 if(_class->type == 3)
10191 {
10192 if(!_class->dataType)
10193 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10194 type = _class->dataType;
10195 }
10196 }
10197 switch(type->kind)
10198 {
10199 case 6:
10200 {
10201 float value;
10202 float (* Get)(float) = (void *)prop->Get;
10203
10204 GetFloat(exp->member.exp, &value);
10205 exp->constant = PrintFloat(Get ? Get(value) : value);
10206 exp->type = 2;
10207 break;
10208 }
10209 case 7:
10210 {
10211 double value;
10212 double (* Get)(double);
10213
10214 GetDouble(exp->member.exp, &value);
10215 if(convertTo)
10216 Get = (void *)prop->Set;
10217 else
10218 Get = (void *)prop->Get;
10219 exp->constant = PrintDouble(Get ? Get(value) : value);
10220 exp->type = 2;
10221 break;
10222 }
10223 }
10224 }
10225 else
10226 {
10227 if(convertTo)
10228 {
10229 struct Expression * value = exp->member.exp;
10230 struct Type * type;
10231
10232 if(!prop->dataType)
10233 ProcessPropertyType(prop);
10234 type = prop->dataType;
10235 if(!type)
10236 {
10237 }
10238 else if(_class->type == 1)
10239 {
10240 switch(type->kind)
10241 {
10242 case 8:
10243 {
10244 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10245
10246 if(propertyClass->type == 1 && value->type == 1)
10247 {
10248 void (* Set)(void *, void *) = (void *)prop->Set;
10249
10250 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10251 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10252 exp->instance->_class = MkSpecifierName(_class->fullName);
10253 exp->instance->loc = exp->loc;
10254 exp->type = 1;
10255 Set(exp->instance->data, value->instance->data);
10256 PopulateInstance(exp->instance);
10257 }
10258 break;
10259 }
10260 case 3:
10261 {
10262 int intValue;
10263 void (* Set)(void *, int) = (void *)prop->Set;
10264
10265 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10266 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10267 exp->instance->_class = MkSpecifierName(_class->fullName);
10268 exp->instance->loc = exp->loc;
10269 exp->type = 1;
10270 GetInt(value, &intValue);
10271 Set(exp->instance->data, intValue);
10272 PopulateInstance(exp->instance);
10273 break;
10274 }
10275 case 4:
10276 {
10277 long long intValue;
10278 void (* Set)(void *, long long) = (void *)prop->Set;
10279
10280 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10281 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10282 exp->instance->_class = MkSpecifierName(_class->fullName);
10283 exp->instance->loc = exp->loc;
10284 exp->type = 1;
10285 GetInt64(value, &intValue);
10286 Set(exp->instance->data, intValue);
10287 PopulateInstance(exp->instance);
10288 break;
10289 }
10290 case 7:
10291 {
10292 double doubleValue;
10293 void (* Set)(void *, double) = (void *)prop->Set;
10294
10295 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10296 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10297 exp->instance->_class = MkSpecifierName(_class->fullName);
10298 exp->instance->loc = exp->loc;
10299 exp->type = 1;
10300 GetDouble(value, &doubleValue);
10301 Set(exp->instance->data, doubleValue);
10302 PopulateInstance(exp->instance);
10303 break;
10304 }
10305 }
10306 }
10307 else if(_class->type == 2)
10308 {
10309 switch(type->kind)
10310 {
10311 case 8:
10312 {
10313 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10314
10315 if(propertyClass->type == 1 && value->instance->data)
10316 {
10317 unsigned int (* Set)(void *) = (void *)prop->Set;
10318 unsigned int bits = Set(value->instance->data);
10319
10320 exp->constant = PrintHexUInt(bits);
10321 exp->type = 2;
10322 break;
10323 }
10324 else if(_class->type == 2)
10325 {
10326 unsigned int value;
10327 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10328 unsigned int bits;
10329
10330 GetUInt(exp->member.exp, &value);
10331 bits = Set(value);
10332 exp->constant = PrintHexUInt(bits);
10333 exp->type = 2;
10334 }
10335 }
10336 }
10337 }
10338 }
10339 else
10340 {
10341 if(_class->type == 2)
10342 {
10343 unsigned int value;
10344
10345 GetUInt(exp->member.exp, &value);
10346 switch(type->kind)
10347 {
10348 case 8:
10349 {
10350 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10351
10352 if(_class->type == 1)
10353 {
10354 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10355
10356 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10357 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10358 exp->instance->_class = MkSpecifierName(_class->fullName);
10359 exp->instance->loc = exp->loc;
10360 exp->type = 1;
10361 Get(value, exp->instance->data);
10362 PopulateInstance(exp->instance);
10363 }
10364 else if(_class->type == 2)
10365 {
10366 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10367 uint64 bits = Get(value);
10368
10369 exp->constant = PrintHexUInt64(bits);
10370 exp->type = 2;
10371 }
10372 break;
10373 }
10374 }
10375 }
10376 else if(_class->type == 1)
10377 {
10378 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10379
10380 switch(type->kind)
10381 {
10382 case 8:
10383 {
10384 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10385
10386 if(_class->type == 1 && value)
10387 {
10388 void (* Get)(void *, void *) = (void *)prop->Get;
10389
10390 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10391 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10392 exp->instance->_class = MkSpecifierName(_class->fullName);
10393 exp->instance->loc = exp->loc;
10394 exp->type = 1;
10395 Get(value, exp->instance->data);
10396 PopulateInstance(exp->instance);
10397 }
10398 break;
10399 }
10400 }
10401 }
10402 }
10403 }
10404 }
10405 else
10406 {
10407 exp->isConstant = 0x0;
10408 }
10409 }
10410 else if(member)
10411 {
10412 }
10413 }
10414 if(exp->type != 8)
10415 {
10416 FreeExpression(memberExp);
10417 FreeIdentifier(memberID);
10418 }
10419 break;
10420 }
10421 case 10:
10422 {
10423 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10424
10425 FreeExpContents(exp);
10426 exp->constant = PrintUInt(ComputeTypeSize(type));
10427 exp->type = 2;
10428 FreeType(type);
10429 break;
10430 }
10431 case 15:
10432 {
10433 struct Symbol * classSym = exp->_class->symbol;
10434
10435 if(classSym && classSym->registered)
10436 {
10437 if(classSym->registered->fixed)
10438 {
10439 FreeSpecifier(exp->_class);
10440 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10441 exp->type = 2;
10442 }
10443 else
10444 {
10445 char className[1024];
10446
10447 strcpy(className, "__ecereClass_");
10448 FullClassNameCat(className, classSym->string, 0x1);
10449 MangleClassName(className);
10450 FreeExpContents(exp);
10451 exp->type = 9;
10452 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10453 exp->member.member = MkIdentifier("structSize");
10454 }
10455 }
10456 break;
10457 }
10458 case 11:
10459 {
10460 struct Type * type;
10461 struct Expression * e = exp;
10462
10463 if(exp->type == 11)
10464 {
10465 if(exp->cast.exp)
10466 ComputeExpression(exp->cast.exp);
10467 e = exp->cast.exp;
10468 }
10469 if(e && exp->expType)
10470 {
10471 type = exp->expType;
10472 if(type->kind == 8)
10473 {
10474 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10475
10476 if(_class && (_class->type == 3 || _class->type == 2))
10477 {
10478 if(!_class->dataType)
10479 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10480 type = _class->dataType;
10481 }
10482 }
10483 switch(type->kind)
10484 {
10485 case 1:
10486 if(type->isSigned)
10487 {
10488 char value;
10489
10490 GetChar(e, &value);
10491 FreeExpContents(exp);
10492 exp->constant = PrintChar(value);
10493 exp->type = 2;
10494 }
10495 else
10496 {
10497 unsigned char value;
10498
10499 GetUChar(e, &value);
10500 FreeExpContents(exp);
10501 exp->constant = PrintUChar(value);
10502 exp->type = 2;
10503 }
10504 break;
10505 case 2:
10506 if(type->isSigned)
10507 {
10508 short value;
10509
10510 GetShort(e, &value);
10511 FreeExpContents(exp);
10512 exp->constant = PrintShort(value);
10513 exp->type = 2;
10514 }
10515 else
10516 {
10517 unsigned short value;
10518
10519 GetUShort(e, &value);
10520 FreeExpContents(exp);
10521 exp->constant = PrintUShort(value);
10522 exp->type = 2;
10523 }
10524 break;
10525 case 3:
10526 if(type->isSigned)
10527 {
10528 int value;
10529
10530 GetInt(e, &value);
10531 FreeExpContents(exp);
10532 exp->constant = PrintInt(value);
10533 exp->type = 2;
10534 }
10535 else
10536 {
10537 unsigned int value;
10538
10539 GetUInt(e, &value);
10540 FreeExpContents(exp);
10541 exp->constant = PrintUInt(value);
10542 exp->type = 2;
10543 }
10544 break;
10545 case 4:
10546 if(type->isSigned)
10547 {
10548 long long value;
10549
10550 GetInt64(e, &value);
10551 FreeExpContents(exp);
10552 exp->constant = PrintInt64(value);
10553 exp->type = 2;
10554 }
10555 else
10556 {
10557 uint64 value;
10558
10559 GetUInt64(e, &value);
10560 FreeExpContents(exp);
10561 exp->constant = PrintUInt64(value);
10562 exp->type = 2;
10563 }
10564 break;
10565 case 6:
10566 {
10567 float value;
10568
10569 GetFloat(e, &value);
10570 FreeExpContents(exp);
10571 exp->constant = PrintFloat(value);
10572 exp->type = 2;
10573 break;
10574 }
10575 case 7:
10576 {
10577 double value;
10578
10579 GetDouble(e, &value);
10580 FreeExpContents(exp);
10581 exp->constant = PrintDouble(value);
10582 exp->type = 2;
10583 break;
10584 }
10585 }
10586 }
10587 break;
10588 }
10589 case 12:
10590 {
10591 struct Operand op1 = 
10592 {
10593 0, 0, 0, 0, 
10594 {
10595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10596 }
10597 };
10598 struct Operand op2 = 
10599 {
10600 0, 0, 0, 0, 
10601 {
10602 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10603 }
10604 };
10605 struct Operand op3 = 
10606 {
10607 0, 0, 0, 0, 
10608 {
10609 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10610 }
10611 };
10612
10613 if(exp->cond.exp)
10614 ComputeExpression((*exp->cond.exp).last);
10615 if(exp->cond.elseExp)
10616 ComputeExpression(exp->cond.elseExp);
10617 if(exp->cond.cond)
10618 ComputeExpression(exp->cond.cond);
10619 op1 = GetOperand(exp->cond.cond);
10620 if(op1.type)
10621 op1.type->refCount++;
10622 op2 = GetOperand((*exp->cond.exp).last);
10623 if(op2.type)
10624 op2.type->refCount++;
10625 op3 = GetOperand(exp->cond.elseExp);
10626 if(op3.type)
10627 op3.type->refCount++;
10628 if(op1.ops.Cond)
10629 {
10630 FreeExpContents(exp);
10631 op1.ops.Cond(exp, &op1, &op2, &op3);
10632 }
10633 if(op1.type)
10634 FreeType(op1.type);
10635 if(op2.type)
10636 FreeType(op2.type);
10637 if(op3.type)
10638 FreeType(op3.type);
10639 break;
10640 }
10641 }
10642 }
10643
10644 void ApplyAnyObjectLogic(struct Expression * e);
10645
10646 extern void CopyTypeInto(struct Type * type, struct Type * src);
10647
10648 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
10649 {
10650 unsigned int result = 0x1;
10651
10652 if(destType)
10653 {
10654 struct __ecereNameSpace__ecere__sys__OldList converts = 
10655 {
10656 0, 0, 0, 0, 0
10657 };
10658 struct Conversion * convert;
10659
10660 if(destType->kind == 0)
10661 return 0x0;
10662 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
10663 result = 0x0;
10664 if(converts.count)
10665 {
10666 for(convert = converts.first; convert; convert = convert->next)
10667 {
10668 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
10669
10670 if(!empty)
10671 {
10672 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10673 int objectType = exp->expType ? exp->expType->classObjectType : 0;
10674
10675 *newExp = *exp;
10676 newExp->destType = (((void *)0));
10677 if(convert->isGet)
10678 {
10679 exp->type = 8;
10680 exp->addedThis = 0x1;
10681 exp->member.exp = newExp;
10682 FreeType(exp->member.exp->expType);
10683 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
10684 exp->member.exp->expType->classObjectType = objectType;
10685 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
10686 exp->member.memberType = 1;
10687 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10688 exp->needCast = 0x1;
10689 if(exp->expType)
10690 exp->expType->refCount++;
10691 ApplyAnyObjectLogic(exp->member.exp);
10692 }
10693 else
10694 {
10695 {
10696 exp->type = 8;
10697 exp->addedThis = 0x1;
10698 exp->member.exp = newExp;
10699 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
10700 {
10701 newExp->byReference = 0x1;
10702 }
10703 FreeType(exp->member.exp->expType);
10704 exp->member.exp->expType = (((void *)0));
10705 if(convert->convert->dataType)
10706 {
10707 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
10708 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
10709 exp->member.exp->expType->refCount = 1;
10710 exp->member.exp->expType->classObjectType = objectType;
10711 ApplyAnyObjectLogic(exp->member.exp);
10712 }
10713 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
10714 exp->member.memberType = 4;
10715 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10716 exp->needCast = 0x1;
10717 if(convert->resultType)
10718 convert->resultType->refCount++;
10719 }
10720 }
10721 }
10722 else
10723 {
10724 FreeType(exp->expType);
10725 if(convert->isGet)
10726 {
10727 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10728 exp->needCast = 0x1;
10729 if(exp->expType)
10730 exp->expType->refCount++;
10731 }
10732 else
10733 {
10734 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10735 exp->needCast = 0x1;
10736 if(convert->resultType)
10737 convert->resultType->refCount++;
10738 }
10739 }
10740 }
10741 if(exp->isConstant && inCompiler)
10742 ComputeExpression(exp);
10743 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
10744 }
10745 if(!result && exp->expType && converts.count)
10746 {
10747 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
10748 }
10749 if(!result && exp->expType && exp->destType)
10750 {
10751 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))
10752 result = 0x1;
10753 }
10754 }
10755 return result;
10756 }
10757
10758 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
10759
10760 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
10761
10762 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
10763
10764 void CheckTemplateTypes(struct Expression * exp)
10765 {
10766 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
10767 {
10768 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10769 struct Statement * compound;
10770 struct Context * context;
10771
10772 *newExp = *exp;
10773 if(exp->destType)
10774 exp->destType->refCount++;
10775 if(exp->expType)
10776 exp->expType->refCount++;
10777 newExp->prev = (((void *)0));
10778 newExp->next = (((void *)0));
10779 switch(exp->expType->kind)
10780 {
10781 case 7:
10782 if(exp->destType->classObjectType)
10783 {
10784 if(exp->destType)
10785 exp->destType->refCount--;
10786 if(exp->expType)
10787 exp->expType->refCount--;
10788 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
10789 }
10790 else
10791 {
10792 struct __ecereNameSpace__ecere__sys__OldList * specs;
10793 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
10794 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
10795
10796 context = PushContext();
10797 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
10798 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
10799 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
10800 exp->type = 25;
10801 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
10802 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
10803 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
10804 exp->compound->compound.context = context;
10805 PopContext(context);
10806 }
10807 break;
10808 default:
10809 exp->type = 11;
10810 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
10811 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
10812 break;
10813 }
10814 }
10815 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
10816 {
10817 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10818 struct Statement * compound;
10819 struct Context * context;
10820
10821 *newExp = *exp;
10822 if(exp->destType)
10823 exp->destType->refCount++;
10824 if(exp->expType)
10825 exp->expType->refCount++;
10826 newExp->prev = (((void *)0));
10827 newExp->next = (((void *)0));
10828 switch(exp->expType->kind)
10829 {
10830 case 7:
10831 if(exp->destType->classObjectType)
10832 {
10833 if(exp->destType)
10834 exp->destType->refCount--;
10835 if(exp->expType)
10836 exp->expType->refCount--;
10837 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
10838 }
10839 else
10840 {
10841 struct __ecereNameSpace__ecere__sys__OldList * specs;
10842 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
10843 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
10844
10845 context = PushContext();
10846 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
10847 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
10848 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
10849 exp->type = 25;
10850 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
10851 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
10852 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
10853 exp->compound->compound.context = context;
10854 PopContext(context);
10855 }
10856 break;
10857 case 8:
10858 {
10859 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
10860 {
10861 exp->type = 5;
10862 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
10863 ProcessExpressionType((*exp->list).first);
10864 break;
10865 }
10866 else
10867 {
10868 exp->type = 5;
10869 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
10870 newExp->needCast = 0x1;
10871 ProcessExpressionType((*exp->list).first);
10872 break;
10873 }
10874 }
10875 default:
10876 {
10877 if(exp->expType->kind == 20)
10878 {
10879 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
10880
10881 if(type)
10882 {
10883 FreeType(exp->destType);
10884 FreeType(exp->expType);
10885 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
10886 break;
10887 }
10888 }
10889 if(newExp->type == 8 && newExp->member.memberType == 3)
10890 {
10891 exp->type = 4;
10892 exp->op.op = '*';
10893 exp->op.exp1 = (((void *)0));
10894 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
10895 }
10896 else
10897 {
10898 char typeString[1024];
10899 struct Declarator * decl;
10900 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
10901
10902 typeString[0] = '\0';
10903 PrintType(exp->expType, typeString, 0x0, 0x0);
10904 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
10905 exp->type = 11;
10906 exp->cast.typeName = MkTypeName(specs, decl);
10907 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
10908 exp->cast.exp->needCast = 0x1;
10909 }
10910 break;
10911 }
10912 }
10913 }
10914 }
10915
10916 extern int strncmp(const char * , const char * , int n);
10917
10918 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
10919
10920 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
10921 {
10922 int nsLen = strlen(nameSpace);
10923 struct Symbol * symbol;
10924
10925 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)))
10926 {
10927 char * s = symbol->string;
10928
10929 if(!strncmp(s, nameSpace, nsLen))
10930 {
10931 int c;
10932 char * namePart;
10933
10934 for(c = strlen(s) - 1; c >= 0; c--)
10935 if(s[c] == ':')
10936 break;
10937 namePart = s + c + 1;
10938 if(!strcmp(namePart, name))
10939 {
10940 return symbol;
10941 }
10942 }
10943 else
10944 break;
10945 }
10946 return (((void *)0));
10947 }
10948
10949 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
10950 {
10951 int c;
10952 char nameSpace[1024];
10953 char * namePart;
10954 unsigned int gotColon = 0x0;
10955
10956 nameSpace[0] = '\0';
10957 for(c = strlen(name) - 1; c >= 0; c--)
10958 if(name[c] == ':')
10959 {
10960 gotColon = 0x1;
10961 break;
10962 }
10963 namePart = name + c + 1;
10964 while(c >= 0 && name[c] == ':')
10965 c--;
10966 if(c >= 0)
10967 {
10968 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
10969
10970 if(symbol)
10971 return symbol;
10972 memcpy(nameSpace, name, c + 1);
10973 nameSpace[c + 1] = (char)0;
10974 return ScanWithNameSpace(tree, nameSpace, namePart);
10975 }
10976 else if(gotColon)
10977 {
10978 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
10979
10980 return symbol;
10981 }
10982 else
10983 {
10984 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
10985
10986 if(symbol)
10987 return symbol;
10988 return ScanWithNameSpace(tree, "", namePart);
10989 }
10990 return (((void *)0));
10991 }
10992
10993 static void ProcessDeclaration(struct Declaration * decl);
10994
10995 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
10996 {
10997 struct Context * ctx;
10998 struct Symbol * symbol = (((void *)0));
10999
11000 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11001 {
11002 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11003 {
11004 symbol = (((void *)0));
11005 if(thisNameSpace)
11006 {
11007 char curName[1024];
11008
11009 strcpy(curName, thisNameSpace);
11010 strcat(curName, "::");
11011 strcat(curName, name);
11012 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11013 }
11014 if(!symbol)
11015 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11016 }
11017 else
11018 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11019 if(symbol || ctx == endContext)
11020 break;
11021 }
11022 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11023 {
11024 if(symbol->pointerExternal->type == 0)
11025 {
11026 struct FunctionDefinition * function = symbol->pointerExternal->function;
11027 struct Context * tmpContext = curContext;
11028
11029 curContext = (((void *)0));
11030 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11031 curContext = tmpContext;
11032 symbol->pointerExternal->symbol = symbol;
11033 DeclareType(symbol->type, 0x1, 0x1);
11034 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11035 symbol->id = curExternal->symbol->idCode;
11036 }
11037 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11038 {
11039 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11040 symbol->id = curExternal->symbol->idCode;
11041 }
11042 }
11043 return symbol;
11044 }
11045
11046 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11047 {
11048 if(!type->isSigned)
11049 ListAdd(specs, MkSpecifier(UNSIGNED));
11050 switch(type->kind)
11051 {
11052 case 8:
11053 {
11054 if(type->_class->registered)
11055 {
11056 if(!type->_class->registered->dataType)
11057 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11058 GetTypeSpecs(type->_class->registered->dataType, specs);
11059 }
11060 break;
11061 }
11062 case 7:
11063 ListAdd(specs, MkSpecifier(DOUBLE));
11064 break;
11065 case 6:
11066 ListAdd(specs, MkSpecifier(FLOAT));
11067 break;
11068 case 1:
11069 ListAdd(specs, MkSpecifier(CHAR));
11070 break;
11071 case 2:
11072 ListAdd(specs, MkSpecifier(SHORT));
11073 break;
11074 case 4:
11075 ListAdd(specs, MkSpecifier(INT64));
11076 break;
11077 case 3:
11078 default:
11079 ListAdd(specs, MkSpecifier(INT));
11080 break;
11081 }
11082 }
11083
11084 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11085
11086 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int printFunction, unsigned int fullName)
11087 {
11088 if(type)
11089 {
11090 switch(type->kind)
11091 {
11092 case 8:
11093 if(type->_class && type->_class->string)
11094 {
11095 if(type->classObjectType == 2)
11096 strcat(string, "typed_object");
11097 else if(fullName)
11098 strcat(string, type->_class->string);
11099 else
11100 {
11101 if(type->_class->registered)
11102 strcat(string, type->_class->registered->name);
11103 else
11104 strcat(string, type->_class->string);
11105 }
11106 }
11107 break;
11108 case 13:
11109 {
11110 {
11111 _PrintType(type->type, string, 0x0, printFunction, fullName);
11112 strcat(string, " *");
11113 }
11114 break;
11115 }
11116 case 0:
11117 strcat(string, "void");
11118 break;
11119 case 3:
11120 strcat(string, type->isSigned ? "int" : "uint");
11121 break;
11122 case 4:
11123 strcat(string, type->isSigned ? "int64" : "uint64");
11124 break;
11125 case 1:
11126 strcat(string, type->isSigned ? "char" : "byte");
11127 break;
11128 case 2:
11129 strcat(string, type->isSigned ? "short" : "uint16");
11130 break;
11131 case 6:
11132 strcat(string, "float");
11133 break;
11134 case 7:
11135 strcat(string, "double");
11136 break;
11137 case 9:
11138 if(type->enumName)
11139 {
11140 strcat(string, "struct ");
11141 strcat(string, type->enumName);
11142 }
11143 else if(type->typeName)
11144 {
11145 strcat(string, type->typeName);
11146 }
11147 else
11148 {
11149 struct Type * member;
11150
11151 strcat(string, "struct {");
11152 for(member = type->members.first; member; member = member->next)
11153 {
11154 PrintType(member, string, 0x1, fullName);
11155 strcat(string, "; ");
11156 }
11157 strcat(string, "}");
11158 }
11159 break;
11160 case 10:
11161 if(type->enumName)
11162 {
11163 strcat(string, "union ");
11164 strcat(string, type->enumName);
11165 }
11166 else if(type->typeName)
11167 {
11168 strcat(string, type->typeName);
11169 }
11170 else
11171 {
11172 strcat(string, "union ");
11173 strcat(string, "(unnamed)");
11174 }
11175 break;
11176 case 15:
11177 if(type->enumName)
11178 {
11179 strcat(string, "enum ");
11180 strcat(string, type->enumName);
11181 }
11182 else if(type->typeName)
11183 {
11184 strcat(string, type->typeName);
11185 }
11186 else
11187 strcat(string, "enum");
11188 break;
11189 case 11:
11190 {
11191 if(printFunction)
11192 {
11193 if(type->dllExport)
11194 strcat(string, "dllexport ");
11195 PrintType(type->returnType, string, 0x0, fullName);
11196 strcat(string, " ");
11197 }
11198 if(printName)
11199 {
11200 if(type->name)
11201 {
11202 if(fullName)
11203 strcat(string, type->name);
11204 else
11205 {
11206 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11207
11208 if(name)
11209 name += 2;
11210 else
11211 name = type->name;
11212 strcat(string, name);
11213 }
11214 }
11215 }
11216 if(printFunction)
11217 {
11218 struct Type * param;
11219
11220 strcat(string, "(");
11221 for(param = type->params.first; param; param = param->next)
11222 {
11223 PrintType(param, string, 0x1, fullName);
11224 if(param->next)
11225 strcat(string, ", ");
11226 }
11227 strcat(string, ")");
11228 }
11229 break;
11230 }
11231 case 12:
11232 {
11233 {
11234 char baseType[1024], size[256];
11235 struct Type * arrayType = type;
11236
11237 baseType[0] = '\0';
11238 size[0] = '\0';
11239 while(arrayType->kind == 12)
11240 {
11241 strcat(size, "[");
11242 if(arrayType->enumClass)
11243 strcat(size, arrayType->enumClass->string);
11244 else if(arrayType->arraySizeExp)
11245 PrintExpression(arrayType->arraySizeExp, size);
11246 strcat(size, "]");
11247 arrayType = arrayType->arrayType;
11248 }
11249 _PrintType(arrayType, baseType, printName, printFunction, fullName);
11250 strcat(string, baseType);
11251 strcat(string, size);
11252 }
11253 printName = 0x0;
11254 break;
11255 }
11256 case 14:
11257 strcat(string, "...");
11258 break;
11259 case 16:
11260 _PrintType(type->method->dataType, string, 0x0, printFunction, fullName);
11261 break;
11262 case 19:
11263 strcat(string, "subclass(");
11264 strcat(string, type->_class ? type->_class->string : "int");
11265 strcat(string, ")");
11266 break;
11267 case 20:
11268 strcat(string, type->templateParameter->identifier->string);
11269 break;
11270 case 21:
11271 strcat(string, "thisclass");
11272 break;
11273 case 17:
11274 strcat(string, "__builtin_va_list");
11275 break;
11276 }
11277 if(type->name && printName && type->kind != 11 && (type->kind != 13 || type->type->kind != 11))
11278 {
11279 strcat(string, " ");
11280 strcat(string, type->name);
11281 }
11282 }
11283 }
11284
11285 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11286 {
11287 struct Type * funcType;
11288
11289 for(funcType = type; funcType && (funcType->kind == 13 || funcType->kind == 12); funcType = funcType->type)
11290 ;
11291 if(funcType && funcType->kind == 11 && type != funcType)
11292 {
11293 char typeString[1024];
11294 struct Type * param;
11295
11296 PrintType(funcType->returnType, string, 0x0, fullName);
11297 strcat(string, "(");
11298 _PrintType(type, string, printName, 0x0, fullName);
11299 strcat(string, ")");
11300 strcat(string, "(");
11301 for(param = funcType->params.first; param; param = param->next)
11302 {
11303 PrintType(param, string, 0x1, fullName);
11304 if(param->next)
11305 strcat(string, ", ");
11306 }
11307 strcat(string, ")");
11308 }
11309 else
11310 _PrintType(type, string, printName, 0x1, fullName);
11311 if(type->bitFieldCount)
11312 {
11313 char count[100];
11314
11315 sprintf(count, ":%d", type->bitFieldCount);
11316 strcat(string, count);
11317 }
11318 }
11319
11320 static struct Type * FindMember(struct Type * type, char * string)
11321 {
11322 struct Type * memberType;
11323
11324 for(memberType = type->members.first; memberType; memberType = memberType->next)
11325 {
11326 if(!memberType->name)
11327 {
11328 struct Type * subType = FindMember(memberType, string);
11329
11330 if(subType)
11331 return subType;
11332 }
11333 else if(!strcmp(memberType->name, string))
11334 return memberType;
11335 }
11336 return (((void *)0));
11337 }
11338
11339 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11340 {
11341 struct Type * memberType;
11342
11343 for(memberType = type->members.first; memberType; memberType = memberType->next)
11344 {
11345 if(!memberType->name)
11346 {
11347 struct Type * subType = FindMember(memberType, string);
11348
11349 if(subType)
11350 {
11351 *offset += memberType->offset;
11352 return subType;
11353 }
11354 }
11355 else if(!strcmp(memberType->name, string))
11356 {
11357 *offset += memberType->offset;
11358 return memberType;
11359 }
11360 }
11361 return (((void *)0));
11362 }
11363
11364 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11365
11366 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11367
11368 struct Expression * ParseExpressionString(char * expression)
11369 {
11370 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11371 ((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));
11372 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11373 echoOn = 0x0;
11374 parsedExpression = (((void *)0));
11375 resetScanner();
11376 expression_yyparse();
11377 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11378 return parsedExpression;
11379 }
11380
11381 extern char *  QMkString(char *  source);
11382
11383 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11384 {
11385 void * __ecereTemp1;
11386 struct Identifier * id = exp->identifier;
11387 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11388 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11389 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11390 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11391
11392 if(_class && _class->type == 4)
11393 {
11394 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11395 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11396
11397 if(enumClass)
11398 {
11399 struct __ecereNameSpace__ecere__com__Class * baseClass;
11400
11401 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11402 {
11403 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11404
11405 for(value = e->values.first; value; value = value->next)
11406 {
11407 if(!strcmp(value->name, id->string))
11408 break;
11409 }
11410 if(value)
11411 {
11412 char constant[256];
11413
11414 FreeExpContents(exp);
11415 exp->type = 2;
11416 exp->isConstant = 0x1;
11417 if(!strcmp(baseClass->dataTypeString, "int"))
11418 sprintf(constant, "%d", value->data);
11419 else
11420 sprintf(constant, "0x%X", value->data);
11421 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11422 exp->expType = MkClassType(baseClass->fullName);
11423 break;
11424 }
11425 }
11426 }
11427 if(value)
11428 return 0x1;
11429 }
11430 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11431 {
11432 ProcessMethodType(method);
11433 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1)->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), ((struct Type *)__ecereTemp1));
11434 return 0x1;
11435 }
11436 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11437 {
11438 if(!prop->dataType)
11439 ProcessPropertyType(prop);
11440 exp->expType = prop->dataType;
11441 if(prop->dataType)
11442 prop->dataType->refCount++;
11443 return 0x1;
11444 }
11445 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11446 {
11447 if(!member->dataType)
11448 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11449 exp->expType = member->dataType;
11450 if(member->dataType)
11451 member->dataType->refCount++;
11452 return 0x1;
11453 }
11454 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11455 {
11456 if(!classProp->dataType)
11457 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11458 if(classProp->constant)
11459 {
11460 FreeExpContents(exp);
11461 exp->isConstant = 0x1;
11462 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11463 {
11464 exp->type = 3;
11465 exp->constant = QMkString((char *)classProp->Get(_class));
11466 }
11467 else
11468 {
11469 char constant[256];
11470
11471 exp->type = 2;
11472 sprintf(constant, "%d", classProp->Get(_class));
11473 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11474 }
11475 }
11476 else
11477 {
11478 }
11479 exp->expType = classProp->dataType;
11480 if(classProp->dataType)
11481 classProp->dataType->refCount++;
11482 return 0x1;
11483 }
11484 return 0x0;
11485 }
11486
11487 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11488 {
11489 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11490 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11491 struct __ecereNameSpace__ecere__com__NameSpace * child;
11492
11493 if(!data)
11494 {
11495 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)))
11496 {
11497 data = ScanGlobalData(child, name);
11498 if(data)
11499 break;
11500 }
11501 }
11502 return data;
11503 }
11504
11505 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11506
11507 extern char *  strncpy(char * , const char * , int n);
11508
11509 static struct GlobalData * FindGlobalData(char * name)
11510 {
11511 int start = 0, c;
11512 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
11513
11514 nameSpace = globalData;
11515 for(c = 0; name[c]; c++)
11516 {
11517 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
11518 {
11519 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
11520 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
11521
11522 strncpy(spaceName, name + start, c - start);
11523 spaceName[c - start] = '\0';
11524 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
11525 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
11526 if(!newSpace)
11527 return (((void *)0));
11528 nameSpace = newSpace;
11529 if(name[c] == ':')
11530 c++;
11531 start = c + 1;
11532 }
11533 }
11534 if(c - start)
11535 {
11536 return ScanGlobalData(nameSpace, name + start);
11537 }
11538 return (((void *)0));
11539 }
11540
11541 static int definedExpStackPos;
11542
11543 static void * definedExpStack[512];
11544
11545 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
11546 {
11547 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
11548
11549 FreeExpContents(checkedExp);
11550 FreeType(checkedExp->expType);
11551 FreeType(checkedExp->destType);
11552 *checkedExp = *newExp;
11553 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11554 checkedExp->prev = prev;
11555 checkedExp->next = next;
11556 }
11557
11558 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
11559
11560 extern int printf(char * , ...);
11561
11562 void __ecereMethod_Expression_Clear();
11563
11564 void ApplyAnyObjectLogic(struct Expression * e)
11565 {
11566 struct Type * destType = e->destType;
11567
11568 if(destType && (destType->classObjectType == 3))
11569 {
11570 if(e && e->expType)
11571 {
11572 struct Type * type = e->expType;
11573 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
11574
11575 if(type->kind == 8 && type->_class && type->_class->registered)
11576 {
11577 _class = type->_class->registered;
11578 }
11579 else if(type->kind == 19)
11580 {
11581 _class = FindClass("ecere::com::Class")->registered;
11582 }
11583 else
11584 {
11585 char string[1024] = "";
11586 struct Symbol * classSym;
11587
11588 PrintType(type, string, 0x0, 0x1);
11589 classSym = FindClass(string);
11590 if(classSym)
11591 _class = classSym->registered;
11592 }
11593 if((_class && (_class->type == 4 || _class->type == 3 || _class->type == 2 || _class->type == 1000) && strcmp(_class->fullName, "class") && strcmp(_class->fullName, "ecere::com::Class")) || (!e->expType->classObjectType && (((type->kind != 13 && type->kind != 19 && (type->kind != 8 || !type->_class || !type->_class->registered || type->_class->registered->type == 1))) || destType->byReference)))
11594 {
11595 if(!_class || strcmp(_class->fullName, "char *"))
11596 {
11597 struct Expression * checkedExp = e, * newExp;
11598
11599 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11600 {
11601 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11602 {
11603 if(checkedExp->type == 25)
11604 {
11605 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11606 }
11607 else
11608 checkedExp = (*checkedExp->list).last;
11609 }
11610 else if(checkedExp->type == 11)
11611 checkedExp = checkedExp->cast.exp;
11612 }
11613 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
11614 {
11615 newExp = checkedExp->op.exp2;
11616 checkedExp->op.exp2 = (((void *)0));
11617 FreeExpContents(checkedExp);
11618 if(e->expType && e->expType->passAsTemplate)
11619 {
11620 char size[100];
11621
11622 ComputeTypeSize(e->expType);
11623 sprintf(size, "%d", e->expType->size);
11624 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))))));
11625 }
11626 ReplaceExpContents(checkedExp, newExp);
11627 e->byReference = 0x1;
11628 }
11629 else if(!e->byReference || (_class && _class->type == 5))
11630 {
11631 struct Expression * checkedExp, * newExp;
11632
11633 {
11634 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;
11635
11636 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
11637 {
11638 struct Context * context = PushContext();
11639 struct Declarator * decl;
11640 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11641 char typeString[1024];
11642 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11643
11644 typeString[0] = '\0';
11645 *newExp = *e;
11646 newExp->prev = (((void *)0));
11647 newExp->next = (((void *)0));
11648 newExp->expType = (((void *)0));
11649 PrintType(e->expType, typeString, 0x0, 0x1);
11650 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11651 newExp->destType = ProcessType(specs, decl);
11652 curContext = context;
11653 e->type = 25;
11654 if(curCompound)
11655 {
11656 char name[100];
11657 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
11658
11659 sprintf(name, "__internalValue%03X", internalValueCounter++);
11660 if(!curCompound->compound.declarations)
11661 curCompound->compound.declarations = MkList();
11662 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
11663 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
11664 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
11665 e->compound = MkCompoundStmt((((void *)0)), stmts);
11666 }
11667 else
11668 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
11669 {
11670 struct Type * type = e->destType;
11671
11672 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11673 CopyTypeInto(e->destType, type);
11674 e->destType->refCount = 1;
11675 e->destType->classObjectType = 0;
11676 FreeType(type);
11677 }
11678 e->compound->compound.context = context;
11679 PopContext(context);
11680 curContext = context->parent;
11681 }
11682 }
11683 checkedExp = e;
11684 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11685 {
11686 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11687 {
11688 if(checkedExp->type == 25)
11689 {
11690 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11691 }
11692 else
11693 checkedExp = (*checkedExp->list).last;
11694 }
11695 else if(checkedExp->type == 11)
11696 checkedExp = checkedExp->cast.exp;
11697 }
11698 {
11699 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11700
11701 *operand = *checkedExp;
11702 checkedExp->destType = (((void *)0));
11703 checkedExp->expType = (((void *)0));
11704 __ecereMethod_Expression_Clear(checkedExp);
11705 checkedExp->type = 4;
11706 checkedExp->op.op = '&';
11707 checkedExp->op.exp1 = (((void *)0));
11708 checkedExp->op.exp2 = operand;
11709 }
11710 }
11711 }
11712 }
11713 }
11714 }
11715 {
11716 }
11717 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))))
11718 {
11719 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && !strcmp(e->expType->_class->registered->name, "class"))
11720 {
11721 return ;
11722 }
11723 else
11724 {
11725 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11726
11727 *thisExp = *e;
11728 thisExp->prev = (((void *)0));
11729 thisExp->next = (((void *)0));
11730 __ecereMethod_Expression_Clear(e);
11731 e->type = 5;
11732 e->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpBrackets(MkListOne(thisExp))));
11733 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
11734 ((struct Expression *)(*e->list).first)->byReference = 0x1;
11735 {
11736 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11737 CopyTypeInto(e->expType, thisExp->expType);
11738 e->expType->byReference = 0x0;
11739 e->expType->refCount = 1;
11740 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))
11741 {
11742 e->expType->classObjectType = 0;
11743 }
11744 }
11745 }
11746 }
11747 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
11748 {
11749 if(destType->kind == 14)
11750 {
11751 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
11752 }
11753 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
11754 {
11755 unsigned int byReference = e->expType->byReference;
11756 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11757 struct Declarator * decl;
11758 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11759 char typeString[1024];
11760 struct Type * type;
11761 int backupClassObjectType;
11762
11763 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
11764 type = e->expType;
11765 else
11766 type = destType;
11767 backupClassObjectType = type->classObjectType;
11768 type->classObjectType = 0;
11769 typeString[0] = '\0';
11770 PrintType(type, typeString, 0x0, 0x1);
11771 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11772 type->classObjectType = backupClassObjectType;
11773 *thisExp = *e;
11774 thisExp->prev = (((void *)0));
11775 thisExp->next = (((void *)0));
11776 __ecereMethod_Expression_Clear(e);
11777 if((type->kind == 8 && type->_class && type->_class->registered && strcmp(type->_class->registered->fullName, "ecere::com::Instance") && (type->_class->registered->type == 1000 || type->_class->registered->type == 2 || type->_class->registered->type == 4 || type->_class->registered->type == 3)) || (type->kind != 13 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
11778 {
11779 e->type = 4;
11780 e->op.op = '*';
11781 e->op.exp1 = (((void *)0));
11782 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
11783 }
11784 else
11785 {
11786 e->type = 11;
11787 e->cast.typeName = MkTypeName(specs, decl);
11788 e->cast.exp = thisExp;
11789 e->byReference = 0x1;
11790 }
11791 e->expType = type;
11792 e->destType = destType;
11793 type->refCount++;
11794 destType->refCount++;
11795 }
11796 }
11797 }
11798
11799 extern char *  strstr(char * , const char * );
11800
11801 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
11802
11803 struct __ecereNameSpace__ecere__com__DefinedExpression
11804 {
11805 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
11806 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
11807 char *  name;
11808 char *  value;
11809 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
11810 } __attribute__ ((gcc_struct));
11811
11812 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
11813
11814 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
11815
11816 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
11817
11818 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
11819
11820 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
11821
11822 extern struct Expression * CopyExpression(struct Expression * exp);
11823
11824 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
11825
11826 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
11827
11828 static void ProcessStatement(struct Statement * stmt);
11829
11830 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
11831
11832 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
11833
11834 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
11835
11836 extern char *  sourceFile;
11837
11838 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
11839
11840 void ProcessExpressionType(struct Expression * exp)
11841 {
11842 void * __ecereTemp2;
11843 void * __ecereTemp1;
11844 unsigned int unresolved = 0x0;
11845 struct Location oldyylloc = yylloc;
11846 unsigned int notByReference = 0x0;
11847
11848 if(!exp || exp->expType)
11849 return ;
11850 yylloc = exp->loc;
11851 switch(exp->type)
11852 {
11853 case 0:
11854 {
11855 struct Identifier * id = exp->identifier;
11856
11857 if(!id)
11858 return ;
11859 if(id->_class && id->_class->name)
11860 {
11861 id->classSym = id->_class->symbol;
11862 }
11863 if(strstr(id->string, "__ecereClass") == id->string)
11864 {
11865 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
11866 break;
11867 }
11868 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
11869 {
11870 ReplaceClassMembers(exp, thisClass);
11871 if(exp->type != 0)
11872 {
11873 ProcessExpressionType(exp);
11874 break;
11875 }
11876 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
11877 break;
11878 }
11879 else
11880 {
11881 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
11882
11883 if(!symbol)
11884 {
11885 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
11886 break;
11887 else
11888 {
11889 if(thisClass)
11890 {
11891 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
11892 if(exp->type != 0)
11893 {
11894 ProcessExpressionType(exp);
11895 break;
11896 }
11897 }
11898 else if(currentClass && !id->_class)
11899 {
11900 if(ResolveIdWithClass(exp, currentClass, 0x1))
11901 break;
11902 }
11903 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
11904 }
11905 }
11906 if(symbol)
11907 {
11908 struct Type * type = symbol->type;
11909 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
11910
11911 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
11912 {
11913 struct Context * context = SetupTemplatesContext(_class);
11914
11915 type = ReplaceThisClassType(_class);
11916 FinishTemplatesContext(context);
11917 if(type)
11918 type->refCount = 0;
11919 }
11920 FreeSpecifier(id->_class);
11921 id->_class = (((void *)0));
11922 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
11923 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
11924 id->classSym = (((void *)0));
11925 exp->expType = type;
11926 if(type)
11927 type->refCount++;
11928 if(type && (type->kind == 15 || (_class && _class->type == 4)))
11929 exp->isConstant = 0x1;
11930 if(symbol->isParam || !strcmp(id->string, "this"))
11931 {
11932 if(_class && _class->type == 1)
11933 exp->byReference = 0x1;
11934 }
11935 if(symbol->isIterator)
11936 {
11937 if(symbol->isIterator == 3)
11938 {
11939 exp->type = 5;
11940 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
11941 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
11942 exp->expType = (((void *)0));
11943 ProcessExpressionType(exp);
11944 }
11945 else if(symbol->isIterator != 4)
11946 {
11947 exp->type = 8;
11948 exp->member.exp = MkExpIdentifier(exp->identifier);
11949 exp->member.exp->expType = exp->expType;
11950 exp->member.member = MkIdentifier("data");
11951 exp->expType = (((void *)0));
11952 ProcessExpressionType(exp);
11953 }
11954 }
11955 break;
11956 }
11957 else
11958 {
11959 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
11960
11961 if(thisNameSpace && !(id->_class && !id->_class->name))
11962 {
11963 char name[1024];
11964
11965 strcpy(name, thisNameSpace);
11966 strcat(name, "::");
11967 strcat(name, id->string);
11968 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
11969 }
11970 if(!definedExp)
11971 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
11972 if(definedExp)
11973 {
11974 int c;
11975
11976 for(c = 0; c < definedExpStackPos; c++)
11977 if(definedExpStack[c] == definedExp)
11978 break;
11979 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
11980 {
11981 struct Location backupYylloc = yylloc;
11982
11983 definedExpStack[definedExpStackPos++] = definedExp;
11984 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11985 ((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));
11986 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11987 echoOn = 0x0;
11988 parsedExpression = (((void *)0));
11989 resetScanner();
11990 expression_yyparse();
11991 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11992 yylloc = backupYylloc;
11993 if(parsedExpression)
11994 {
11995 FreeIdentifier(id);
11996 exp->type = 5;
11997 exp->list = MkListOne(parsedExpression);
11998 parsedExpression->loc = yylloc;
11999 ProcessExpressionType(exp);
12000 definedExpStackPos--;
12001 return ;
12002 }
12003 definedExpStackPos--;
12004 }
12005 else
12006 {
12007 if(inCompiler)
12008 {
12009 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12010 }
12011 }
12012 }
12013 else
12014 {
12015 struct GlobalData * data = (((void *)0));
12016
12017 if(thisNameSpace && !(id->_class && !id->_class->name))
12018 {
12019 char name[1024];
12020
12021 strcpy(name, thisNameSpace);
12022 strcat(name, "::");
12023 strcat(name, id->string);
12024 data = FindGlobalData(name);
12025 }
12026 if(!data)
12027 data = FindGlobalData(id->string);
12028 if(data)
12029 {
12030 DeclareGlobalData(data);
12031 exp->expType = data->dataType;
12032 if(data->dataType)
12033 data->dataType->refCount++;
12034 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12035 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12036 FreeSpecifier(id->_class);
12037 id->_class = (((void *)0));
12038 break;
12039 }
12040 else
12041 {
12042 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12043
12044 if(thisNameSpace && !(id->_class && !id->_class->name))
12045 {
12046 char name[1024];
12047
12048 strcpy(name, thisNameSpace);
12049 strcat(name, "::");
12050 strcat(name, id->string);
12051 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12052 }
12053 if(!function)
12054 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12055 if(function)
12056 {
12057 char name[1024];
12058
12059 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12060 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12061 name[0] = (char)0;
12062 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12063 strcpy(name, "__ecereFunction_");
12064 FullClassNameCat(name, id->string, 0x0);
12065 if(DeclareFunction(function, name))
12066 {
12067 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12068 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12069 }
12070 exp->expType = function->dataType;
12071 if(function->dataType)
12072 function->dataType->refCount++;
12073 FreeSpecifier(id->_class);
12074 id->_class = (((void *)0));
12075 break;
12076 }
12077 }
12078 }
12079 }
12080 }
12081 unresolved = 0x1;
12082 break;
12083 }
12084 case 1:
12085 {
12086 struct __ecereNameSpace__ecere__com__Class * _class;
12087
12088 if(!exp->instance->_class)
12089 {
12090 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12091 {
12092 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12093 }
12094 }
12095 ProcessInstantiationType(exp->instance);
12096 exp->isConstant = exp->instance->isConstant;
12097 if(exp->instance->_class)
12098 {
12099 exp->expType = MkClassType(exp->instance->_class->name);
12100 }
12101 break;
12102 }
12103 case 2:
12104 {
12105 if(!exp->expType)
12106 {
12107 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12108
12109 exp->expType = type;
12110 if(exp->constant[0] == '\'')
12111 {
12112 if((int)((unsigned char *)exp->constant)[1] > 127)
12113 {
12114 int nb;
12115 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12116
12117 if(nb < 2)
12118 ch = exp->constant[1];
12119 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12120 exp->constant = PrintUInt(ch);
12121 type->kind = 8;
12122 type->_class = FindClass("unichar");
12123 type->isSigned = 0x0;
12124 }
12125 else
12126 {
12127 type->kind = 1;
12128 type->isSigned = 0x1;
12129 }
12130 }
12131 else if(strchr(exp->constant, '.'))
12132 {
12133 char ch = exp->constant[strlen(exp->constant) - 1];
12134
12135 if(ch == 'f')
12136 type->kind = 6;
12137 else
12138 type->kind = 7;
12139 type->isSigned = 0x1;
12140 }
12141 else
12142 {
12143 if(exp->constant[0] == '0' && exp->constant[1])
12144 type->isSigned = 0x0;
12145 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12146 type->isSigned = 0x0;
12147 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12148 type->isSigned = 0x0;
12149 else
12150 type->isSigned = 0x1;
12151 type->kind = 3;
12152 }
12153 exp->isConstant = 0x1;
12154 }
12155 break;
12156 }
12157 case 3:
12158 {
12159 exp->isConstant = 0x1;
12160 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->constant = 0x1, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
12161 break;
12162 }
12163 case 13:
12164 case 28:
12165 ProcessExpressionType(exp->_new.size);
12166 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), ((struct Type *)__ecereTemp1));
12167 DeclareType(exp->expType->type, 0x0, 0x0);
12168 break;
12169 case 14:
12170 case 29:
12171 ProcessExpressionType(exp->_renew.size);
12172 ProcessExpressionType(exp->_renew.exp);
12173 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), ((struct Type *)__ecereTemp1));
12174 DeclareType(exp->expType->type, 0x0, 0x0);
12175 break;
12176 case 4:
12177 {
12178 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12179 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12180 unsigned int useDestType = 0x0, useSideType = 0x0;
12181 struct Location oldyylloc = yylloc;
12182 unsigned int useSideUnit = 0x0;
12183 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12184
12185 switch(exp->op.op)
12186 {
12187 case '=':
12188 case MUL_ASSIGN:
12189 case DIV_ASSIGN:
12190 case MOD_ASSIGN:
12191 case ADD_ASSIGN:
12192 case SUB_ASSIGN:
12193 case LEFT_ASSIGN:
12194 case RIGHT_ASSIGN:
12195 case AND_ASSIGN:
12196 case XOR_ASSIGN:
12197 case OR_ASSIGN:
12198 assign = 0x1;
12199 break;
12200 case '!':
12201 break;
12202 case AND_OP:
12203 case OR_OP:
12204 boolOps = 0x1;
12205 boolResult = 0x1;
12206 break;
12207 case EQ_OP:
12208 case '<':
12209 case '>':
12210 case LE_OP:
12211 case GE_OP:
12212 case NE_OP:
12213 boolResult = 0x1;
12214 useSideType = 0x1;
12215 break;
12216 case '+':
12217 case '-':
12218 useSideUnit = 0x1;
12219 case '|':
12220 case '&':
12221 case '^':
12222 case '/':
12223 case '%':
12224 case '*':
12225 if(exp->op.op != '*' || exp->op.exp1)
12226 {
12227 useSideType = 0x1;
12228 useDestType = 0x1;
12229 }
12230 break;
12231 }
12232 if(exp->op.op == '&')
12233 {
12234 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12235 {
12236 struct Identifier * id = exp->op.exp2->identifier;
12237 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12238
12239 if(symbol && symbol->isIterator == 2)
12240 {
12241 exp->type = 8;
12242 exp->member.exp = exp->op.exp2;
12243 exp->member.member = MkIdentifier("key");
12244 exp->expType = (((void *)0));
12245 exp->op.exp2->expType = symbol->type;
12246 symbol->type->refCount++;
12247 ProcessExpressionType(exp);
12248 FreeType(dummy);
12249 break;
12250 }
12251 }
12252 }
12253 if(exp->op.exp1)
12254 {
12255 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))
12256 {
12257 if(exp->op.exp1->destType)
12258 FreeType(exp->op.exp1->destType);
12259 exp->op.exp1->destType = exp->destType;
12260 if(exp->destType)
12261 exp->destType->refCount++;
12262 }
12263 else if(!assign)
12264 {
12265 if(exp->op.exp1->destType)
12266 FreeType(exp->op.exp1->destType);
12267 exp->op.exp1->destType = dummy;
12268 dummy->refCount++;
12269 }
12270 if(exp->op.exp1->destType && exp->op.op != '=')
12271 exp->op.exp1->destType->count++;
12272 ProcessExpressionType(exp->op.exp1);
12273 if(exp->op.exp1->destType && exp->op.op != '=')
12274 exp->op.exp1->destType->count--;
12275 if(exp->op.exp1->destType == dummy)
12276 {
12277 FreeType(dummy);
12278 exp->op.exp1->destType = (((void *)0));
12279 }
12280 type1 = exp->op.exp1->expType;
12281 }
12282 if(exp->op.exp2)
12283 {
12284 char expString[10240];
12285
12286 expString[0] = '\0';
12287 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12288 {
12289 if(exp->op.exp1)
12290 {
12291 exp->op.exp2->destType = exp->op.exp1->expType;
12292 if(exp->op.exp1->expType)
12293 exp->op.exp1->expType->refCount++;
12294 }
12295 else
12296 {
12297 exp->op.exp2->destType = exp->destType;
12298 if(exp->destType)
12299 exp->destType->refCount++;
12300 }
12301 if(type1)
12302 type1->refCount++;
12303 exp->expType = type1;
12304 }
12305 else if(assign)
12306 {
12307 if(inCompiler)
12308 PrintExpression(exp->op.exp2, expString);
12309 if(type1 && type1->kind == 13)
12310 {
12311 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)
12312 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12313 else if(exp->op.op == '=')
12314 {
12315 if(exp->op.exp2->destType)
12316 FreeType(exp->op.exp2->destType);
12317 exp->op.exp2->destType = type1;
12318 if(type1)
12319 type1->refCount++;
12320 }
12321 }
12322 else
12323 {
12324 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)
12325 ;
12326 else
12327 {
12328 if(exp->op.exp2->destType)
12329 FreeType(exp->op.exp2->destType);
12330 exp->op.exp2->destType = type1;
12331 if(type1)
12332 type1->refCount++;
12333 }
12334 }
12335 if(type1)
12336 type1->refCount++;
12337 exp->expType = type1;
12338 }
12339 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)))
12340 {
12341 if(exp->op.exp2->destType)
12342 FreeType(exp->op.exp2->destType);
12343 exp->op.exp2->destType = exp->destType;
12344 if(exp->destType)
12345 exp->destType->refCount++;
12346 }
12347 else
12348 {
12349 if(exp->op.exp2->destType)
12350 FreeType(exp->op.exp2->destType);
12351 exp->op.exp2->destType = dummy;
12352 dummy->refCount++;
12353 }
12354 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12355 {
12356 FreeType(exp->op.exp2->destType);
12357 exp->op.exp2->destType = type1;
12358 type1->refCount++;
12359 }
12360 if(exp->op.exp2->destType && exp->op.op != '=')
12361 exp->op.exp2->destType->count++;
12362 ProcessExpressionType(exp->op.exp2);
12363 if(exp->op.exp2->destType && exp->op.op != '=')
12364 exp->op.exp2->destType->count--;
12365 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12366 {
12367 if(exp->op.exp2->expType->kind == 4 || exp->op.exp2->expType->kind == 3 || exp->op.exp2->expType->kind == 2 || exp->op.exp2->expType->kind == 1)
12368 {
12369 if(exp->op.op != '=' && type1->type->kind == 0)
12370 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12371 }
12372 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)))
12373 {
12374 if(exp->op.op == ADD_ASSIGN)
12375 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12376 }
12377 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))
12378 {
12379 if(exp->op.op == ADD_ASSIGN)
12380 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12381 }
12382 else if(inCompiler)
12383 {
12384 char type1String[1024];
12385 char type2String[1024];
12386
12387 type1String[0] = '\0';
12388 type2String[0] = '\0';
12389 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12390 PrintType(type1, type2String, 0x0, 0x1);
12391 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12392 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12393 }
12394 }
12395 if(exp->op.exp2->destType == dummy)
12396 {
12397 FreeType(dummy);
12398 exp->op.exp2->destType = (((void *)0));
12399 }
12400 type2 = exp->op.exp2->expType;
12401 }
12402 dummy->kind = 0;
12403 if(exp->op.op == SIZEOF)
12404 {
12405 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
12406 exp->isConstant = 0x1;
12407 }
12408 else if(exp->op.op == '*' && !exp->op.exp1)
12409 {
12410 exp->expType = Dereference(type2);
12411 if(type2 && type2->kind == 8)
12412 notByReference = 0x1;
12413 }
12414 else if(exp->op.op == '&' && !exp->op.exp1)
12415 exp->expType = Reference(type2);
12416 else if(!assign)
12417 {
12418 if(boolOps)
12419 {
12420 if(exp->op.exp1)
12421 {
12422 if(exp->op.exp1->destType)
12423 FreeType(exp->op.exp1->destType);
12424 exp->op.exp1->destType = MkClassType("bool");
12425 exp->op.exp1->destType->truth = 0x1;
12426 if(!exp->op.exp1->expType)
12427 ProcessExpressionType(exp->op.exp1);
12428 else
12429 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12430 FreeType(exp->op.exp1->expType);
12431 exp->op.exp1->expType = MkClassType("bool");
12432 exp->op.exp1->expType->truth = 0x1;
12433 }
12434 if(exp->op.exp2)
12435 {
12436 if(exp->op.exp2->destType)
12437 FreeType(exp->op.exp2->destType);
12438 exp->op.exp2->destType = MkClassType("bool");
12439 exp->op.exp2->destType->truth = 0x1;
12440 if(!exp->op.exp2->expType)
12441 ProcessExpressionType(exp->op.exp2);
12442 else
12443 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12444 FreeType(exp->op.exp2->expType);
12445 exp->op.exp2->expType = MkClassType("bool");
12446 exp->op.exp2->expType->truth = 0x1;
12447 }
12448 }
12449 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")))))
12450 {
12451 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12452 {
12453 if(exp->op.exp2->destType)
12454 FreeType(exp->op.exp2->destType);
12455 exp->op.exp2->destType = type1;
12456 type1->refCount++;
12457 if(exp->op.exp1->destType)
12458 FreeType(exp->op.exp1->destType);
12459 exp->op.exp1->destType = type2;
12460 type2->refCount++;
12461 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)
12462 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);
12463 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12464 {
12465 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12466
12467 if(argExp)
12468 {
12469 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12470
12471 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12472 ProcessExpressionType(exp->op.exp1);
12473 if(type2->kind != 13)
12474 {
12475 ProcessExpressionType(classExp);
12476 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"))))))));
12477 if(!exp->op.exp2->expType)
12478 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12479 ProcessExpressionType(exp->op.exp2);
12480 }
12481 }
12482 }
12483 if(!boolResult && ((type1->kind == 13 || type1->kind == 12 || (type1->kind == 8 && !strcmp(type1->_class->string, "String"))) && (type2->kind == 4 || type2->kind == 3 || type2->kind == 2 || type2->kind == 1)))
12484 {
12485 if(type1->kind != 8 && type1->type->kind == 0)
12486 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12487 exp->expType = type1;
12488 if(type1)
12489 type1->refCount++;
12490 }
12491 else if(!boolResult && ((type2->kind == 13 || type2->kind == 12 || (type2->kind == 8 && !strcmp(type2->_class->string, "String"))) && (type1->kind == 4 || type1->kind == 3 || type1->kind == 2 || type1->kind == 1)))
12492 {
12493 if(type2->kind != 8 && type2->type->kind == 0)
12494 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12495 exp->expType = type2;
12496 if(type2)
12497 type2->refCount++;
12498 }
12499 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))
12500 {
12501 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
12502 }
12503 else
12504 {
12505 unsigned int success = 0x0;
12506
12507 if(type1->kind == 13 && type2->kind == 13)
12508 {
12509 if(exp->op.op == '+')
12510 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12511 else if(exp->op.op == '-')
12512 {
12513 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12514 {
12515 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
12516 success = 0x1;
12517 if(type1->type->kind == 20)
12518 {
12519 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12520
12521 if(argExp)
12522 {
12523 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12524
12525 ProcessExpressionType(classExp);
12526 exp->type = 5;
12527 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")))))));
12528 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12529 FreeType(dummy);
12530 return ;
12531 }
12532 }
12533 }
12534 }
12535 }
12536 if(!success && exp->op.exp1->type == 2)
12537 {
12538 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12539 {
12540 if(exp->expType)
12541 FreeType(exp->expType);
12542 exp->expType = exp->op.exp1->destType;
12543 if(exp->op.exp1->destType)
12544 exp->op.exp1->destType->refCount++;
12545 success = 0x1;
12546 }
12547 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12548 {
12549 if(exp->expType)
12550 FreeType(exp->expType);
12551 exp->expType = exp->op.exp2->destType;
12552 if(exp->op.exp2->destType)
12553 exp->op.exp2->destType->refCount++;
12554 success = 0x1;
12555 }
12556 }
12557 else if(!success)
12558 {
12559 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12560 {
12561 if(exp->expType)
12562 FreeType(exp->expType);
12563 exp->expType = exp->op.exp2->destType;
12564 if(exp->op.exp2->destType)
12565 exp->op.exp2->destType->refCount++;
12566 success = 0x1;
12567 }
12568 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12569 {
12570 if(exp->expType)
12571 FreeType(exp->expType);
12572 exp->expType = exp->op.exp1->destType;
12573 if(exp->op.exp1->destType)
12574 exp->op.exp1->destType->refCount++;
12575 success = 0x1;
12576 }
12577 }
12578 if(!success)
12579 {
12580 char expString1[10240];
12581 char expString2[10240];
12582 char type1[1024];
12583 char type2[1024];
12584
12585 expString1[0] = '\0';
12586 expString2[0] = '\0';
12587 type1[0] = '\0';
12588 type2[0] = '\0';
12589 if(inCompiler)
12590 {
12591 PrintExpression(exp->op.exp1, expString1);
12592 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12593 PrintExpression(exp->op.exp2, expString2);
12594 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12595 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
12596 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
12597 }
12598 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
12599 }
12600 }
12601 }
12602 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12603 {
12604 if(exp->op.exp1->destType)
12605 FreeType(exp->op.exp1->destType);
12606 exp->op.exp1->destType = type2->_class->registered->dataType;
12607 if(type2->_class->registered->dataType)
12608 type2->_class->registered->dataType->refCount++;
12609 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12610 exp->expType = type2;
12611 if(type2)
12612 type2->refCount++;
12613 }
12614 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12615 {
12616 if(exp->op.exp2->destType)
12617 FreeType(exp->op.exp2->destType);
12618 exp->op.exp2->destType = type1->_class->registered->dataType;
12619 if(type1->_class->registered->dataType)
12620 type1->_class->registered->dataType->refCount++;
12621 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12622 exp->expType = type1;
12623 if(type1)
12624 type1->refCount++;
12625 }
12626 else if(type1)
12627 {
12628 unsigned int valid = 0x0;
12629
12630 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
12631 {
12632 if(exp->op.exp2->destType)
12633 FreeType(exp->op.exp2->destType);
12634 if(!type1->_class->registered->dataType)
12635 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
12636 exp->op.exp2->destType = type1->_class->registered->dataType;
12637 exp->op.exp2->destType->refCount++;
12638 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12639 type2 = exp->op.exp2->destType;
12640 exp->expType = type2;
12641 type2->refCount++;
12642 }
12643 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
12644 {
12645 if(exp->op.exp1->destType)
12646 FreeType(exp->op.exp1->destType);
12647 if(!type2->_class->registered->dataType)
12648 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
12649 exp->op.exp1->destType = type2->_class->registered->dataType;
12650 exp->op.exp1->destType->refCount++;
12651 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12652 type1 = exp->op.exp1->destType;
12653 exp->expType = type1;
12654 type1->refCount++;
12655 }
12656 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
12657 {
12658 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
12659 {
12660 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
12661 {
12662 if(exp->expType)
12663 FreeType(exp->expType);
12664 exp->expType = exp->op.exp1->expType;
12665 if(exp->op.exp2->expType)
12666 exp->op.exp1->expType->refCount++;
12667 valid = 0x1;
12668 }
12669 }
12670 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
12671 {
12672 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
12673 {
12674 if(exp->expType)
12675 FreeType(exp->expType);
12676 exp->expType = exp->op.exp2->expType;
12677 if(exp->op.exp2->expType)
12678 exp->op.exp2->expType->refCount++;
12679 valid = 0x1;
12680 }
12681 }
12682 }
12683 if(!valid)
12684 {
12685 if(exp->op.exp2->destType)
12686 FreeType(exp->op.exp2->destType);
12687 exp->op.exp2->destType = type1;
12688 type1->refCount++;
12689 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12690 {
12691 if(exp->expType)
12692 FreeType(exp->expType);
12693 exp->expType = exp->op.exp2->destType;
12694 if(exp->op.exp2->destType)
12695 exp->op.exp2->destType->refCount++;
12696 }
12697 else if(type1 && type2)
12698 {
12699 char expString1[10240];
12700 char expString2[10240];
12701 char type1String[1024];
12702 char type2String[1024];
12703
12704 expString1[0] = '\0';
12705 expString2[0] = '\0';
12706 type1String[0] = '\0';
12707 type2String[0] = '\0';
12708 if(inCompiler)
12709 {
12710 PrintExpression(exp->op.exp1, expString1);
12711 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12712 PrintExpression(exp->op.exp2, expString2);
12713 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12714 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
12715 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
12716 }
12717 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
12718 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
12719 {
12720 exp->expType = exp->op.exp1->expType;
12721 if(exp->op.exp1->expType)
12722 exp->op.exp1->expType->refCount++;
12723 }
12724 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12725 {
12726 exp->expType = exp->op.exp2->expType;
12727 if(exp->op.exp2->expType)
12728 exp->op.exp2->expType->refCount++;
12729 }
12730 }
12731 }
12732 }
12733 else if(type2)
12734 {
12735 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12736 {
12737 struct Type * oldType = exp->op.exp1->expType;
12738
12739 exp->op.exp1->expType = (((void *)0));
12740 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12741 FreeType(oldType);
12742 else
12743 exp->op.exp1->expType = oldType;
12744 }
12745 if(exp->op.exp1->destType)
12746 FreeType(exp->op.exp1->destType);
12747 exp->op.exp1->destType = type2;
12748 type2->refCount++;
12749 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12750 {
12751 if(exp->expType)
12752 FreeType(exp->expType);
12753 exp->expType = exp->op.exp1->destType;
12754 if(exp->op.exp1->destType)
12755 exp->op.exp1->destType->refCount++;
12756 }
12757 }
12758 }
12759 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
12760 {
12761 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12762 {
12763 if(exp->op.exp1->destType)
12764 FreeType(exp->op.exp1->destType);
12765 exp->op.exp1->destType = type2->_class->registered->dataType;
12766 if(type2->_class->registered->dataType)
12767 type2->_class->registered->dataType->refCount++;
12768 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12769 }
12770 if(exp->op.op == '!')
12771 {
12772 exp->expType = MkClassType("bool");
12773 exp->expType->truth = 0x1;
12774 }
12775 else
12776 {
12777 exp->expType = type2;
12778 if(type2)
12779 type2->refCount++;
12780 }
12781 }
12782 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
12783 {
12784 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12785 {
12786 if(exp->op.exp2->destType)
12787 FreeType(exp->op.exp2->destType);
12788 exp->op.exp2->destType = type1->_class->registered->dataType;
12789 if(type1->_class->registered->dataType)
12790 type1->_class->registered->dataType->refCount++;
12791 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12792 }
12793 exp->expType = type1;
12794 if(type1)
12795 type1->refCount++;
12796 }
12797 }
12798 yylloc = exp->loc;
12799 if(exp->op.exp1 && !exp->op.exp1->expType)
12800 {
12801 char expString[10000];
12802
12803 expString[0] = '\0';
12804 if(inCompiler)
12805 {
12806 PrintExpression(exp->op.exp1, expString);
12807 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12808 }
12809 if(expString[0])
12810 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
12811 }
12812 if(exp->op.exp2 && !exp->op.exp2->expType)
12813 {
12814 char expString[10240];
12815
12816 expString[0] = '\0';
12817 if(inCompiler)
12818 {
12819 PrintExpression(exp->op.exp2, expString);
12820 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12821 }
12822 if(expString[0])
12823 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
12824 }
12825 if(boolResult)
12826 {
12827 FreeType(exp->expType);
12828 exp->expType = MkClassType("bool");
12829 exp->expType->truth = 0x1;
12830 }
12831 if(exp->op.op != SIZEOF)
12832 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
12833 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
12834 {
12835 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
12836 }
12837 yylloc = oldyylloc;
12838 FreeType(dummy);
12839 break;
12840 }
12841 case 5:
12842 case 34:
12843 {
12844 struct Expression * e;
12845
12846 exp->isConstant = 0x1;
12847 for(e = (*exp->list).first; e; e = e->next)
12848 {
12849 unsigned int inced = 0x0;
12850
12851 if(!e->next)
12852 {
12853 FreeType(e->destType);
12854 e->destType = exp->destType;
12855 if(e->destType)
12856 {
12857 exp->destType->refCount++;
12858 e->destType->count++;
12859 inced = 0x1;
12860 }
12861 }
12862 ProcessExpressionType(e);
12863 if(inced)
12864 exp->destType->count--;
12865 if(!exp->expType && !e->next)
12866 {
12867 exp->expType = e->expType;
12868 if(e->expType)
12869 e->expType->refCount++;
12870 }
12871 if(!e->isConstant)
12872 exp->isConstant = 0x0;
12873 }
12874 e = (*exp->list).first;
12875 if(!e->next && e->type == 8)
12876 {
12877 struct Expression * next = exp->next, * prev = exp->prev;
12878
12879 FreeType(exp->expType);
12880 FreeType(exp->destType);
12881 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
12882 *exp = *e;
12883 exp->prev = prev;
12884 exp->next = next;
12885 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
12886 ProcessExpressionType(exp);
12887 }
12888 break;
12889 }
12890 case 6:
12891 {
12892 struct Expression * e;
12893
12894 exp->isConstant = 0x1;
12895 ProcessExpressionType(exp->index.exp);
12896 if(!exp->index.exp->isConstant)
12897 exp->isConstant = 0x0;
12898 if(exp->index.exp->expType)
12899 {
12900 struct Type * source = exp->index.exp->expType;
12901
12902 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)
12903 {
12904 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
12905
12906 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
12907 if(exp->index.index && (*exp->index.index).last)
12908 {
12909 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
12910 }
12911 }
12912 }
12913 for(e = (*exp->index.index).first; e; e = e->next)
12914 {
12915 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
12916 {
12917 if(e->destType)
12918 FreeType(e->destType);
12919 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
12920 }
12921 ProcessExpressionType(e);
12922 if(!e->next)
12923 {
12924 }
12925 if(!e->isConstant)
12926 exp->isConstant = 0x0;
12927 }
12928 if(!exp->expType)
12929 exp->expType = Dereference(exp->index.exp->expType);
12930 if(exp->expType)
12931 DeclareType(exp->expType, 0x0, 0x0);
12932 break;
12933 }
12934 case 7:
12935 {
12936 struct Expression * e;
12937 struct Type * functionType;
12938 struct Type * methodType = (((void *)0));
12939 char name[1024];
12940
12941 name[0] = '\0';
12942 if(inCompiler)
12943 {
12944 PrintExpression(exp->call.exp, name);
12945 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
12946 {
12947 PrintExpression(exp->call.exp, name);
12948 }
12949 }
12950 if(exp->call.exp->type == 0)
12951 {
12952 struct Expression * idExp = exp->call.exp;
12953 struct Identifier * id = idExp->identifier;
12954
12955 if(!strcmp(id->string, "__ENDIAN_PAD"))
12956 {
12957 exp->expType = ProcessTypeString("int", 0x1);
12958 if(exp->call.arguments && (*exp->call.arguments).first)
12959 ProcessExpressionType((*exp->call.arguments).first);
12960 break;
12961 }
12962 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
12963 {
12964 struct Expression * a = (((void *)0));
12965 struct Expression * b = (((void *)0));
12966 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
12967
12968 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
12969 {
12970 a = (*exp->call.arguments).first;
12971 b = (*exp->call.arguments).last;
12972 tempExp1 = a;
12973 tempExp2 = b;
12974 }
12975 else if((*exp->call.arguments).count == 1)
12976 {
12977 a = (*exp->call.arguments).first;
12978 tempExp1 = a;
12979 }
12980 if(a)
12981 {
12982 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
12983 idExp->identifier = (((void *)0));
12984 FreeExpContents(exp);
12985 ProcessExpressionType(a);
12986 if(b)
12987 ProcessExpressionType(b);
12988 exp->type = 5;
12989 exp->list = MkList();
12990 if(a->expType && (!b || b->expType))
12991 {
12992 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
12993 {
12994 if(inCompiler)
12995 {
12996 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12997 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
12998 struct Declaration * decl;
12999 char temp1[1024], temp2[1024];
13000
13001 GetTypeSpecs(a->expType, specs);
13002 if(a && !a->isConstant && a->type != 0)
13003 {
13004 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13005 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13006 tempExp1 = QMkExpId(temp1);
13007 tempExp1->expType = a->expType;
13008 if(a->expType)
13009 a->expType->refCount++;
13010 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13011 }
13012 if(b && !b->isConstant && b->type != 0)
13013 {
13014 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13015 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13016 tempExp2 = QMkExpId(temp2);
13017 tempExp2->expType = b->expType;
13018 if(b->expType)
13019 b->expType->refCount++;
13020 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13021 }
13022 decl = MkDeclaration(specs, decls);
13023 if(!curCompound->compound.declarations)
13024 curCompound->compound.declarations = MkList();
13025 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13026 }
13027 }
13028 }
13029 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13030 {
13031 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13032
13033 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13034 exp->expType = a->expType;
13035 if(a->expType)
13036 a->expType->refCount++;
13037 }
13038 else if(!strcmp(id->string, "Abs"))
13039 {
13040 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13041 exp->expType = a->expType;
13042 if(a->expType)
13043 a->expType->refCount++;
13044 }
13045 else if(!strcmp(id->string, "Sgn"))
13046 {
13047 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"))))));
13048 exp->expType = ProcessTypeString("int", 0x0);
13049 }
13050 FreeExpression(tempExp1);
13051 if(tempExp2)
13052 FreeExpression(tempExp2);
13053 FreeIdentifier(id);
13054 break;
13055 }
13056 }
13057 }
13058 {
13059 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
13060
13061 if(!exp->call.exp->destType)
13062 {
13063 exp->call.exp->destType = dummy;
13064 dummy->refCount++;
13065 }
13066 ProcessExpressionType(exp->call.exp);
13067 if(exp->call.exp->destType == dummy)
13068 {
13069 FreeType(dummy);
13070 exp->call.exp->destType = (((void *)0));
13071 }
13072 FreeType(dummy);
13073 }
13074 functionType = exp->call.exp->expType;
13075 if(functionType && functionType->kind == 16)
13076 {
13077 methodType = functionType;
13078 functionType = methodType->method->dataType;
13079 if(exp->call.exp->expType->usedClass)
13080 {
13081 char typeString[1024];
13082
13083 typeString[0] = '\0';
13084 PrintType(functionType, typeString, 0x1, 0x1);
13085 if(strstr(typeString, "thisclass"))
13086 {
13087 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13088 struct Declarator * decl;
13089
13090 {
13091 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13092
13093 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13094 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13095 thisClassParams = 0x0;
13096 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13097 {
13098 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13099
13100 thisClass = exp->call.exp->expType->usedClass;
13101 ProcessDeclarator(decl);
13102 thisClass = backupThisClass;
13103 }
13104 thisClassParams = 0x1;
13105 functionType = ProcessType(specs, decl);
13106 functionType->refCount = 0;
13107 FinishTemplatesContext(context);
13108 }
13109 FreeList(specs, FreeSpecifier);
13110 FreeDeclarator(decl);
13111 }
13112 }
13113 }
13114 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13115 {
13116 struct Type * type = functionType->type;
13117
13118 if(!functionType->refCount)
13119 {
13120 functionType->type = (((void *)0));
13121 FreeType(functionType);
13122 }
13123 functionType = type;
13124 }
13125 if(functionType && functionType->kind != 11)
13126 {
13127 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13128 }
13129 else if(functionType)
13130 {
13131 unsigned int emptyParams = 0x0, noParams = 0x0;
13132 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13133 struct Type * type = functionType->params.first;
13134 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13135 int extra = 0;
13136 struct Location oldyylloc = yylloc;
13137
13138 if(!type)
13139 emptyParams = 0x1;
13140 if(functionType->extraParam && e)
13141 {
13142 e->destType = MkClassType(functionType->thisClass->string);
13143 e = e->next;
13144 }
13145 if(!functionType->staticMethod)
13146 {
13147 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13148 {
13149 type = MkClassType(memberExp->member.exp->expType->_class->string);
13150 if(e)
13151 {
13152 e->destType = type;
13153 e = e->next;
13154 type = functionType->params.first;
13155 }
13156 else
13157 type->refCount = 0;
13158 }
13159 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13160 {
13161 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13162 if(e)
13163 {
13164 e->destType = type;
13165 e = e->next;
13166 type = functionType->params.first;
13167 }
13168 else
13169 type->refCount = 0;
13170 }
13171 }
13172 if(type && type->kind == 0)
13173 {
13174 noParams = 0x1;
13175 if(!type->refCount)
13176 FreeType(type);
13177 type = (((void *)0));
13178 }
13179 for(; e; e = e->next)
13180 {
13181 if(!type && !emptyParams)
13182 {
13183 yylloc = e->loc;
13184 if(methodType && methodType->methodClass)
13185 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);
13186 else
13187 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);
13188 break;
13189 }
13190 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13191 {
13192 struct Type * templatedType = (((void *)0));
13193 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13194 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13195 int id = 0;
13196
13197 if(_class && _class->templateArgs)
13198 {
13199 struct __ecereNameSpace__ecere__com__Class * sClass;
13200
13201 for(sClass = _class; sClass; sClass = sClass->base)
13202 {
13203 if(sClass->templateClass)
13204 sClass = sClass->templateClass;
13205 id = 0;
13206 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13207 {
13208 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13209 {
13210 struct __ecereNameSpace__ecere__com__Class * nextClass;
13211
13212 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13213 {
13214 if(nextClass->templateClass)
13215 nextClass = nextClass->templateClass;
13216 id += nextClass->templateParams.count;
13217 }
13218 break;
13219 }
13220 id++;
13221 }
13222 if(curParam)
13223 break;
13224 }
13225 }
13226 if(curParam && _class->templateArgs[id].dataTypeString)
13227 {
13228 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13229
13230 {
13231 struct Context * context = SetupTemplatesContext(_class);
13232
13233 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13234 FinishTemplatesContext(context);
13235 }
13236 e->destType = templatedType;
13237 if(templatedType)
13238 {
13239 templatedType->passAsTemplate = 0x1;
13240 }
13241 }
13242 else
13243 {
13244 e->destType = type;
13245 if(type)
13246 type->refCount++;
13247 }
13248 }
13249 else
13250 {
13251 e->destType = type;
13252 if(type)
13253 type->refCount++;
13254 }
13255 if(type && type->kind != 14)
13256 {
13257 struct Type * next = type->next;
13258
13259 if(!type->refCount)
13260 FreeType(type);
13261 type = next;
13262 }
13263 }
13264 if(type && type->kind != 14)
13265 {
13266 if(methodType && methodType->methodClass)
13267 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);
13268 else
13269 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);
13270 }
13271 yylloc = oldyylloc;
13272 if(type && !type->refCount)
13273 FreeType(type);
13274 }
13275 else
13276 {
13277 functionType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 0, ((struct Type *)__ecereTemp1)->kind = 11, ((struct Type *)__ecereTemp1));
13278 if(exp->call.exp->type == 0)
13279 {
13280 char * string = exp->call.exp->identifier->string;
13281
13282 if(inCompiler)
13283 {
13284 struct Symbol * symbol;
13285 struct Location oldyylloc = yylloc;
13286
13287 yylloc = exp->call.exp->identifier->loc;
13288 if(strstr(string, "__builtin_") == string)
13289 ;
13290 else
13291 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13292 symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString(string), ((struct Symbol *)__ecereTemp1)->type = ProcessTypeString("int()", 0x1), ((struct Symbol *)__ecereTemp1));
13293 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13294 if(strstr(symbol->string, "::"))
13295 globalContext->hasNameSpace = 0x1;
13296 yylloc = oldyylloc;
13297 }
13298 }
13299 else if(exp->call.exp->type == 8)
13300 {
13301 }
13302 else
13303 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13304 if(!functionType->returnType)
13305 {
13306 functionType->returnType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13307 }
13308 }
13309 if(functionType && functionType->kind == 11)
13310 {
13311 exp->expType = functionType->returnType;
13312 if(functionType->returnType)
13313 functionType->returnType->refCount++;
13314 if(!functionType->refCount)
13315 FreeType(functionType);
13316 }
13317 if(exp->call.arguments)
13318 {
13319 for(e = (*exp->call.arguments).first; e; e = e->next)
13320 {
13321 struct Type * destType = e->destType;
13322
13323 ProcessExpressionType(e);
13324 }
13325 }
13326 break;
13327 }
13328 case 8:
13329 {
13330 struct Type * type;
13331 struct Location oldyylloc = yylloc;
13332 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13333
13334 exp->thisPtr = thisPtr;
13335 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13336 {
13337 exp->member.member->classSym = exp->member.member->_class->symbol;
13338 }
13339 ProcessExpressionType(exp->member.exp);
13340 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)
13341 {
13342 exp->isConstant = 0x0;
13343 }
13344 else
13345 exp->isConstant = exp->member.exp->isConstant;
13346 type = exp->member.exp->expType;
13347 yylloc = exp->loc;
13348 if(type && (type->kind == 20))
13349 {
13350 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13351 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13352
13353 if(_class)
13354 {
13355 for(param = _class->templateParams.first; param; param = param->next)
13356 {
13357 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13358 break;
13359 }
13360 }
13361 if(param && param->defaultArg.member)
13362 {
13363 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13364
13365 if(argExp)
13366 {
13367 struct Expression * expMember = exp->member.exp;
13368 struct Declarator * decl;
13369 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13370 char thisClassTypeString[1024];
13371
13372 FreeIdentifier(exp->member.member);
13373 ProcessExpressionType(argExp);
13374 {
13375 char * colon = strstr(param->defaultArg.memberString, "::");
13376
13377 if(colon)
13378 {
13379 char className[1024];
13380 struct __ecereNameSpace__ecere__com__Class * sClass;
13381
13382 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13383 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13384 }
13385 else
13386 strcpy(thisClassTypeString, _class->fullName);
13387 }
13388 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13389 exp->expType = ProcessType(specs, decl);
13390 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13391 {
13392 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13393 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13394 int c;
13395 int paramCount = 0;
13396 int lastParam = -1;
13397 char templateString[1024];
13398 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13399
13400 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13401 for(cClass = expClass; cClass; cClass = cClass->base)
13402 {
13403 int p = 0;
13404
13405 for(param = cClass->templateParams.first; param; param = param->next)
13406 {
13407 int id = p;
13408 struct __ecereNameSpace__ecere__com__Class * sClass;
13409 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13410
13411 for(sClass = cClass->base; sClass; sClass = sClass->base)
13412 id += sClass->templateParams.count;
13413 arg = expClass->templateArgs[id];
13414 for(sClass = _class; sClass; sClass = sClass->base)
13415 {
13416 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13417 int p = 0;
13418 struct __ecereNameSpace__ecere__com__Class * nextClass;
13419
13420 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13421 p += nextClass->templateParams.count;
13422 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13423 {
13424 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13425 {
13426 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13427 {
13428 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13429 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13430 break;
13431 }
13432 }
13433 }
13434 }
13435 {
13436 char argument[256];
13437
13438 argument[0] = '\0';
13439 switch(param->type)
13440 {
13441 case 2:
13442 {
13443 char expString[1024];
13444 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13445 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13446 struct Expression * exp;
13447 char * string = PrintHexUInt64(arg.expression.ui64);
13448
13449 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13450 ProcessExpressionType(exp);
13451 ComputeExpression(exp);
13452 expString[0] = '\0';
13453 PrintExpression(exp, expString);
13454 strcat(argument, expString);
13455 FreeExpression(exp);
13456 break;
13457 }
13458 case 1:
13459 {
13460 strcat(argument, arg.member->name);
13461 break;
13462 }
13463 case 0:
13464 {
13465 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13466 {
13467 if(!strcmp(arg.dataTypeString, "thisclass"))
13468 strcat(argument, thisClassTypeString);
13469 else
13470 strcat(argument, arg.dataTypeString);
13471 }
13472 break;
13473 }
13474 }
13475 if(argument[0])
13476 {
13477 if(paramCount)
13478 strcat(templateString, ", ");
13479 if(lastParam != p - 1)
13480 {
13481 strcat(templateString, param->name);
13482 strcat(templateString, " = ");
13483 }
13484 strcat(templateString, argument);
13485 paramCount++;
13486 lastParam = p;
13487 }
13488 p++;
13489 }
13490 }
13491 }
13492 {
13493 int len = strlen(templateString);
13494
13495 if(templateString[len - 1] == '>')
13496 templateString[len++] = ' ';
13497 templateString[len++] = '>';
13498 templateString[len++] = '\0';
13499 }
13500 {
13501 struct Context * context = SetupTemplatesContext(_class);
13502
13503 FreeType(exp->expType);
13504 exp->expType = ProcessTypeString(templateString, 0x0);
13505 FinishTemplatesContext(context);
13506 }
13507 }
13508 exp->type = 5;
13509 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")))))))));
13510 }
13511 }
13512 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13513 {
13514 type = ProcessTemplateParameterType(type->templateParameter);
13515 }
13516 }
13517 if(type && (type->kind == 20))
13518 ;
13519 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13520 {
13521 struct Identifier * id = exp->member.member;
13522 int typeKind = type->kind;
13523 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));
13524
13525 if(typeKind == 19 && exp->member.exp->type == 26)
13526 {
13527 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
13528 typeKind = 8;
13529 }
13530 if(id && (typeKind == 3 || typeKind == 15))
13531 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
13532 if(_class && id)
13533 {
13534 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13535 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13536 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13537 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
13538 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13539
13540 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
13541 exp->member.memberType = 1;
13542 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
13543 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
13544 if(typeKind != 19)
13545 {
13546 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
13547 {
13548 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13549 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
13550 {
13551 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13552 if(prop)
13553 member = (((void *)0));
13554 }
13555 if(!member && !prop)
13556 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13557 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
13558 exp->member.thisPtr = 0x1;
13559 }
13560 else
13561 {
13562 if(!id->classSym)
13563 {
13564 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
13565 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13566 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
13567 }
13568 if(!prop && !member)
13569 {
13570 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
13571 if(!method)
13572 {
13573 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13574 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13575 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13576 }
13577 }
13578 if(member && prop)
13579 {
13580 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
13581 prop = (((void *)0));
13582 else
13583 member = (((void *)0));
13584 }
13585 }
13586 }
13587 if(!prop && !member)
13588 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
13589 if(!prop && !member && !method)
13590 {
13591 if(typeKind == 19)
13592 {
13593 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
13594 if(classProp)
13595 {
13596 exp->member.memberType = 5;
13597 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
13598 }
13599 else
13600 {
13601 char structName[1024];
13602 struct Identifier * id = exp->member.member;
13603 struct Expression * classExp = exp->member.exp;
13604
13605 type->refCount++;
13606 FreeType(classExp->expType);
13607 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
13608 strcpy(structName, "__ecereClassData_");
13609 FullClassNameCat(structName, type->_class->string, 0x0);
13610 exp->type = 9;
13611 exp->member.member = id;
13612 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"))))))));
13613 FreeType(type);
13614 ProcessExpressionType(exp);
13615 return ;
13616 }
13617 }
13618 else
13619 {
13620 struct Symbol * classSym = FindClass(id->string);
13621
13622 if(classSym)
13623 {
13624 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
13625
13626 if(convertClass)
13627 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
13628 }
13629 }
13630 }
13631 if(prop)
13632 {
13633 exp->member.memberType = 1;
13634 if(!prop->dataType)
13635 ProcessPropertyType(prop);
13636 exp->expType = prop->dataType;
13637 if(prop->dataType)
13638 prop->dataType->refCount++;
13639 }
13640 else if(member)
13641 {
13642 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13643 {
13644 FreeExpContents(exp);
13645 exp->type = 0;
13646 exp->identifier = MkIdentifier("class");
13647 ProcessExpressionType(exp);
13648 return ;
13649 }
13650 exp->member.memberType = 3;
13651 DeclareStruct(_class->fullName, 0x0);
13652 if(!member->dataType)
13653 {
13654 struct Context * context = SetupTemplatesContext(_class);
13655
13656 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
13657 FinishTemplatesContext(context);
13658 }
13659 exp->expType = member->dataType;
13660 if(member->dataType)
13661 member->dataType->refCount++;
13662 }
13663 else if(revConvert)
13664 {
13665 exp->member.memberType = 4;
13666 exp->expType = MkClassType(revConvert->_class->fullName);
13667 }
13668 else if(method)
13669 {
13670 if(inCompiler)
13671 {
13672 exp->member.memberType = 2;
13673 }
13674 if(!method->dataType)
13675 ProcessMethodType(method);
13676 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1));
13677 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
13678 exp->expType->usedClass = _class;
13679 }
13680 else if(!classProp)
13681 {
13682 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13683 {
13684 FreeExpContents(exp);
13685 exp->type = 0;
13686 exp->identifier = MkIdentifier("class");
13687 ProcessExpressionType(exp);
13688 return ;
13689 }
13690 yylloc = exp->member.member->loc;
13691 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
13692 if(inCompiler)
13693 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
13694 }
13695 if(_class && exp->expType)
13696 {
13697 struct __ecereNameSpace__ecere__com__Class * tClass;
13698
13699 tClass = _class;
13700 while(tClass && !tClass->templateClass)
13701 tClass = tClass->base;
13702 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
13703 {
13704 int id = 0;
13705 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13706 struct __ecereNameSpace__ecere__com__Class * sClass;
13707
13708 for(sClass = tClass; sClass; sClass = sClass->base)
13709 {
13710 id = 0;
13711 if(sClass->templateClass)
13712 sClass = sClass->templateClass;
13713 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13714 {
13715 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
13716 {
13717 for(sClass = sClass->base; sClass; sClass = sClass->base)
13718 id += sClass->templateParams.count;
13719 break;
13720 }
13721 id++;
13722 }
13723 if(curParam)
13724 break;
13725 }
13726 if(curParam && tClass->templateArgs[id].dataTypeString)
13727 {
13728 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13729 struct Context * context = SetupTemplatesContext(tClass);
13730
13731 FreeType(exp->expType);
13732 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
13733 if(exp->expType)
13734 {
13735 if(exp->expType->kind == 21)
13736 {
13737 FreeType(exp->expType);
13738 exp->expType = ReplaceThisClassType(_class);
13739 }
13740 if(tClass->templateClass)
13741 exp->expType->passAsTemplate = 0x1;
13742 if(!exp->destType)
13743 {
13744 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
13745 if(exp->destType->kind == 21)
13746 {
13747 FreeType(exp->destType);
13748 exp->destType = ReplaceThisClassType(_class);
13749 }
13750 }
13751 }
13752 FinishTemplatesContext(context);
13753 }
13754 }
13755 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
13756 {
13757 int id = 0;
13758 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13759 struct __ecereNameSpace__ecere__com__Class * sClass;
13760
13761 for(sClass = tClass; sClass; sClass = sClass->base)
13762 {
13763 id = 0;
13764 if(sClass->templateClass)
13765 sClass = sClass->templateClass;
13766 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13767 {
13768 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
13769 {
13770 for(sClass = sClass->base; sClass; sClass = sClass->base)
13771 id += sClass->templateParams.count;
13772 break;
13773 }
13774 id++;
13775 }
13776 if(curParam)
13777 break;
13778 }
13779 if(curParam)
13780 {
13781 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13782 struct Context * context = SetupTemplatesContext(tClass);
13783 struct Type * basicType;
13784
13785 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
13786 if(basicType)
13787 {
13788 if(basicType->kind == 21)
13789 {
13790 FreeType(basicType);
13791 basicType = ReplaceThisClassType(_class);
13792 }
13793 FreeType(exp->expType);
13794 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = basicType, ((struct Type *)__ecereTemp1));
13795 if(!exp->destType)
13796 {
13797 exp->destType = exp->expType;
13798 exp->destType->refCount++;
13799 }
13800 {
13801 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13802 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13803 struct Declarator * decl;
13804
13805 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
13806 *newExp = *exp;
13807 if(exp->destType)
13808 exp->destType->refCount++;
13809 if(exp->expType)
13810 exp->expType->refCount++;
13811 exp->type = 11;
13812 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
13813 exp->cast.exp = newExp;
13814 }
13815 }
13816 FinishTemplatesContext(context);
13817 }
13818 }
13819 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
13820 {
13821 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13822
13823 if(expClass)
13824 {
13825 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13826 int c;
13827 int p = 0;
13828 int paramCount = 0;
13829 int lastParam = -1;
13830 char templateString[1024];
13831 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13832
13833 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13834 while(cClass != expClass)
13835 {
13836 struct __ecereNameSpace__ecere__com__Class * sClass;
13837
13838 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
13839 ;
13840 cClass = sClass;
13841 for(param = cClass->templateParams.first; param; param = param->next)
13842 {
13843 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
13844 int c;
13845 int cp = 0;
13846 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
13847 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13848
13849 while(cClassCur != tClass && !paramCur)
13850 {
13851 struct __ecereNameSpace__ecere__com__Class * sClassCur;
13852
13853 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
13854 ;
13855 cClassCur = sClassCur;
13856 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
13857 {
13858 if(!strcmp(paramCur->name, param->name))
13859 {
13860 break;
13861 }
13862 cp++;
13863 }
13864 }
13865 if(paramCur && paramCur->type == 0)
13866 arg = tClass->templateArgs[cp];
13867 else
13868 arg = expClass->templateArgs[p];
13869 {
13870 char argument[256];
13871
13872 argument[0] = '\0';
13873 switch(param->type)
13874 {
13875 case 2:
13876 {
13877 char expString[1024];
13878 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13879 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13880 struct Expression * exp;
13881 char * string = PrintHexUInt64(arg.expression.ui64);
13882
13883 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13884 ProcessExpressionType(exp);
13885 ComputeExpression(exp);
13886 expString[0] = '\0';
13887 PrintExpression(exp, expString);
13888 strcat(argument, expString);
13889 FreeExpression(exp);
13890 break;
13891 }
13892 case 1:
13893 {
13894 strcat(argument, arg.member->name);
13895 break;
13896 }
13897 case 0:
13898 {
13899 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13900 strcat(argument, arg.dataTypeString);
13901 break;
13902 }
13903 }
13904 if(argument[0])
13905 {
13906 if(paramCount)
13907 strcat(templateString, ", ");
13908 if(lastParam != p - 1)
13909 {
13910 strcat(templateString, param->name);
13911 strcat(templateString, " = ");
13912 }
13913 strcat(templateString, argument);
13914 paramCount++;
13915 lastParam = p;
13916 }
13917 }
13918 p++;
13919 }
13920 }
13921 {
13922 int len = strlen(templateString);
13923
13924 if(templateString[len - 1] == '>')
13925 templateString[len++] = ' ';
13926 templateString[len++] = '>';
13927 templateString[len++] = '\0';
13928 }
13929 FreeType(exp->expType);
13930 {
13931 struct Context * context = SetupTemplatesContext(tClass);
13932
13933 exp->expType = ProcessTypeString(templateString, 0x0);
13934 FinishTemplatesContext(context);
13935 }
13936 }
13937 }
13938 }
13939 }
13940 else
13941 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)");
13942 }
13943 else if(type && (type->kind == 9 || type->kind == 10))
13944 {
13945 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
13946
13947 if(memberType)
13948 {
13949 exp->expType = memberType;
13950 if(memberType)
13951 memberType->refCount++;
13952 }
13953 }
13954 else
13955 {
13956 char expString[10240];
13957
13958 expString[0] = '\0';
13959 if(inCompiler)
13960 {
13961 PrintExpression(exp, expString);
13962 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13963 }
13964 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
13965 }
13966 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
13967 {
13968 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13969 {
13970 struct Identifier * id = exp->member.member;
13971 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));
13972
13973 if(_class)
13974 {
13975 FreeType(exp->expType);
13976 exp->expType = ReplaceThisClassType(_class);
13977 }
13978 }
13979 }
13980 yylloc = oldyylloc;
13981 break;
13982 }
13983 case 9:
13984 {
13985 struct Type * destType = exp->destType;
13986
13987 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13988 {
13989 exp->member.member->classSym = exp->member.member->_class->symbol;
13990 }
13991 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
13992 exp->type = 8;
13993 if(destType)
13994 destType->count++;
13995 ProcessExpressionType(exp);
13996 if(destType)
13997 destType->count--;
13998 break;
13999 }
14000 case 15:
14001 {
14002 struct Symbol * classSym = exp->_class->symbol;
14003
14004 if(classSym && classSym->registered)
14005 {
14006 if(classSym->registered->type == 5)
14007 {
14008 char name[1024];
14009
14010 name[0] = '\0';
14011 DeclareStruct(classSym->string, 0x0);
14012 FreeSpecifier(exp->_class);
14013 exp->type = 10;
14014 FullClassNameCat(name, classSym->string, 0x0);
14015 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14016 }
14017 else
14018 {
14019 if(classSym->registered->fixed)
14020 {
14021 FreeSpecifier(exp->_class);
14022 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14023 exp->type = 2;
14024 }
14025 else
14026 {
14027 char className[1024];
14028
14029 strcpy(className, "__ecereClass_");
14030 FullClassNameCat(className, classSym->string, 0x1);
14031 MangleClassName(className);
14032 DeclareClass(classSym, className);
14033 FreeExpContents(exp);
14034 exp->type = 9;
14035 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14036 exp->member.member = MkIdentifier("structSize");
14037 }
14038 }
14039 }
14040 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14041 break;
14042 }
14043 case 10:
14044 {
14045 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14046
14047 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14048 exp->isConstant = 0x1;
14049 DeclareType(type, 0x0, 0x0);
14050 FreeType(type);
14051 break;
14052 }
14053 case 11:
14054 {
14055 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14056
14057 type->count = (unsigned int)1;
14058 FreeType(exp->cast.exp->destType);
14059 exp->cast.exp->destType = type;
14060 type->refCount++;
14061 ProcessExpressionType(exp->cast.exp);
14062 type->count = (unsigned int)0;
14063 exp->expType = type;
14064 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14065 {
14066 void * prev = exp->prev, * next = exp->next;
14067 struct Type * expType = exp->cast.exp->destType;
14068 struct Expression * castExp = exp->cast.exp;
14069 struct Type * destType = exp->destType;
14070
14071 if(expType)
14072 expType->refCount++;
14073 FreeType(exp->expType);
14074 FreeTypeName(exp->cast.typeName);
14075 *exp = *castExp;
14076 FreeType(exp->expType);
14077 FreeType(exp->destType);
14078 exp->expType = expType;
14079 exp->destType = destType;
14080 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14081 exp->prev = prev;
14082 exp->next = next;
14083 }
14084 else
14085 {
14086 exp->isConstant = exp->cast.exp->isConstant;
14087 }
14088 break;
14089 }
14090 case 35:
14091 {
14092 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14093
14094 type->refCount++;
14095 exp->expType = type;
14096 break;
14097 }
14098 case 36:
14099 {
14100 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14101
14102 ProcessExpressionType(exp->vaArg.exp);
14103 type->refCount++;
14104 exp->expType = type;
14105 break;
14106 }
14107 case 12:
14108 {
14109 struct Expression * e;
14110
14111 exp->isConstant = 0x1;
14112 FreeType(exp->cond.cond->destType);
14113 exp->cond.cond->destType = MkClassType("bool");
14114 exp->cond.cond->destType->truth = 0x1;
14115 ProcessExpressionType(exp->cond.cond);
14116 if(!exp->cond.cond->isConstant)
14117 exp->isConstant = 0x0;
14118 for(e = (*exp->cond.exp).first; e; e = e->next)
14119 {
14120 if(!e->next)
14121 {
14122 FreeType(e->destType);
14123 e->destType = exp->destType;
14124 if(e->destType)
14125 e->destType->refCount++;
14126 }
14127 ProcessExpressionType(e);
14128 if(!e->next)
14129 {
14130 exp->expType = e->expType;
14131 if(e->expType)
14132 e->expType->refCount++;
14133 }
14134 if(!e->isConstant)
14135 exp->isConstant = 0x0;
14136 }
14137 FreeType(exp->cond.elseExp->destType);
14138 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14139 if(exp->cond.elseExp->destType)
14140 exp->cond.elseExp->destType->refCount++;
14141 ProcessExpressionType(exp->cond.elseExp);
14142 if(!exp->cond.elseExp->isConstant)
14143 exp->isConstant = 0x0;
14144 break;
14145 }
14146 case 25:
14147 {
14148 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14149 {
14150 struct Statement * last = (*exp->compound->compound.statements).last;
14151
14152 if(last->type == 3 && last->expressions && (*last->expressions).last)
14153 {
14154 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14155 if(exp->destType)
14156 exp->destType->refCount++;
14157 }
14158 ProcessStatement(exp->compound);
14159 exp->expType = ((struct Expression *)(*last->expressions).last)->expType;
14160 if(((struct Expression *)(*last->expressions).last)->expType)
14161 exp->expType->refCount++;
14162 }
14163 break;
14164 }
14165 case 26:
14166 {
14167 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14168
14169 if(spec && spec->type == 1)
14170 {
14171 exp->expType = MkClassType(spec->name);
14172 exp->expType->kind = 19;
14173 exp->byReference = 0x1;
14174 }
14175 else
14176 {
14177 exp->expType = MkClassType("ecere::com::Class");
14178 exp->byReference = 0x1;
14179 }
14180 break;
14181 }
14182 case 27:
14183 {
14184 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14185
14186 if(_class)
14187 {
14188 struct Identifier * id = exp->classData.id;
14189 char structName[1024];
14190 struct Expression * classExp;
14191
14192 strcpy(structName, "__ecereClassData_");
14193 FullClassNameCat(structName, _class->fullName, 0x0);
14194 exp->type = 9;
14195 exp->member.member = id;
14196 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14197 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14198 else
14199 classExp = MkExpIdentifier(MkIdentifier("class"));
14200 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"))))))));
14201 ProcessExpressionType(exp);
14202 return ;
14203 }
14204 break;
14205 }
14206 case 37:
14207 {
14208 struct Type * type = (((void *)0));
14209 char * typeString = (((void *)0));
14210 char typeStringBuf[1024];
14211
14212 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))
14213 {
14214 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14215
14216 typeString = templateClass->templateArgs[2].dataTypeString;
14217 }
14218 else if(exp->list)
14219 {
14220 struct Expression * e;
14221
14222 for(e = (*exp->list).first; e; e = e->next)
14223 {
14224 ProcessExpressionType(e);
14225 if(e->expType)
14226 {
14227 if(!type)
14228 {
14229 type = e->expType;
14230 type->refCount++;
14231 }
14232 else
14233 {
14234 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14235 {
14236 FreeType(type);
14237 type = e->expType;
14238 e->expType = (((void *)0));
14239 e = (*exp->list).first;
14240 ProcessExpressionType(e);
14241 if(e->expType)
14242 {
14243 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14244 {
14245 FreeType(e->expType);
14246 e->expType = (((void *)0));
14247 FreeType(type);
14248 type = (((void *)0));
14249 break;
14250 }
14251 }
14252 }
14253 }
14254 if(e->expType)
14255 {
14256 FreeType(e->expType);
14257 e->expType = (((void *)0));
14258 }
14259 }
14260 }
14261 if(type)
14262 {
14263 typeStringBuf[0] = '\0';
14264 PrintType(type, typeStringBuf, 0x0, 0x1);
14265 typeString = typeStringBuf;
14266 FreeType(type);
14267 type = (((void *)0));
14268 }
14269 }
14270 if(typeString)
14271 {
14272 char templateString[1024];
14273 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14274 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14275 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14276 struct Expression * expExt;
14277 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14278
14279 sprintf(templateString, "Container<%s>", typeString);
14280 if(exp->list)
14281 {
14282 struct Expression * e;
14283
14284 type = ProcessTypeString(typeString, 0x0);
14285 while(e = (*exp->list).first)
14286 {
14287 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14288 e->destType = type;
14289 type->refCount++;
14290 ProcessExpressionType(e);
14291 ListAdd(initializers, MkInitializerAssignment(e));
14292 }
14293 FreeType(type);
14294 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14295 }
14296 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14297 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14298 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14299 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14300 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14301 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14302 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14303 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14304 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14305 ListAdd(structInitializers, MkInitializerAssignment((__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression), ((struct Expression *)__ecereTemp1)->type = 2, ((struct Expression *)__ecereTemp1)->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, 0), ((struct Expression *)__ecereTemp1))));
14306 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14307 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14308 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14309 exp->expType = ProcessTypeString(templateString, 0x0);
14310 exp->type = 5;
14311 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14312 ProcessExpressionType(expExt);
14313 }
14314 else
14315 {
14316 exp->expType = ProcessTypeString("Container", 0x0);
14317 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14318 }
14319 break;
14320 }
14321 }
14322 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14323 {
14324 FreeType(exp->expType);
14325 exp->expType = ReplaceThisClassType(thisClass);
14326 }
14327 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14328 {
14329 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14330
14331 if(symbol)
14332 {
14333 if(exp->expType->kind != 15)
14334 {
14335 struct Type * member;
14336 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14337
14338 FreeType(exp->expType);
14339 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14340 exp->expType->kind = symbol->type->kind;
14341 exp->expType->refCount++;
14342 exp->expType->enumName = enumName;
14343 exp->expType->members = symbol->type->members;
14344 for(member = symbol->type->members.first; member; member = member->next)
14345 member->refCount++;
14346 }
14347 else
14348 {
14349 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14350
14351 for(member = symbol->type->members.first; member; member = member->next)
14352 {
14353 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(16), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14354
14355 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14356 }
14357 }
14358 }
14359 }
14360 yylloc = exp->loc;
14361 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14362 ;
14363 else if(exp->destType && !exp->destType->keepCast)
14364 {
14365 if(!CheckExpressionType(exp, exp->destType, 0x0))
14366 {
14367 if(!exp->destType->count || unresolved)
14368 {
14369 if(!exp->expType)
14370 {
14371 yylloc = exp->loc;
14372 if(exp->destType->kind != 14)
14373 {
14374 char type2[1024];
14375
14376 type2[0] = '\0';
14377 if(inCompiler)
14378 {
14379 char expString[10240];
14380
14381 expString[0] = '\0';
14382 PrintType(exp->destType, type2, 0x0, 0x1);
14383 if(inCompiler)
14384 {
14385 PrintExpression(exp, expString);
14386 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14387 }
14388 if(unresolved)
14389 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14390 else if(exp->type != 16)
14391 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14392 }
14393 }
14394 else
14395 {
14396 char expString[10240];
14397
14398 expString[0] = '\0';
14399 if(inCompiler)
14400 {
14401 PrintExpression(exp, expString);
14402 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14403 }
14404 if(unresolved)
14405 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
14406 else if(exp->type != 16)
14407 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14408 }
14409 }
14410 else
14411 {
14412 char type1[1024];
14413 char type2[1024];
14414
14415 type1[0] = '\0';
14416 type2[0] = '\0';
14417 if(inCompiler)
14418 {
14419 PrintType(exp->expType, type1, 0x0, 0x1);
14420 PrintType(exp->destType, type2, 0x0, 0x1);
14421 }
14422 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)))
14423 ;
14424 else
14425 {
14426 char expString[10240];
14427
14428 expString[0] = '\0';
14429 if(inCompiler)
14430 {
14431 PrintExpression(exp, expString);
14432 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14433 }
14434 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
14435 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
14436 FreeType(exp->expType);
14437 exp->destType->refCount++;
14438 exp->expType = exp->destType;
14439 }
14440 }
14441 }
14442 }
14443 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14444 {
14445 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14446 char typeString[1024];
14447 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14448 struct Declarator * decl;
14449
14450 typeString[0] = '\0';
14451 *newExp = *exp;
14452 if(exp->expType)
14453 exp->expType->refCount++;
14454 if(exp->expType)
14455 exp->expType->refCount++;
14456 exp->type = 11;
14457 newExp->destType = exp->expType;
14458 PrintType(exp->expType, typeString, 0x0, 0x0);
14459 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14460 exp->cast.typeName = MkTypeName(specs, decl);
14461 exp->cast.exp = newExp;
14462 }
14463 }
14464 else if(unresolved)
14465 {
14466 if(exp->identifier->_class && exp->identifier->_class->name)
14467 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
14468 else if(exp->identifier->string && exp->identifier->string[0])
14469 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
14470 }
14471 else if(!exp->expType && exp->type != 16)
14472 {
14473 char expString[10240];
14474
14475 expString[0] = '\0';
14476 if(inCompiler)
14477 {
14478 PrintExpression(exp, expString);
14479 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14480 }
14481 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14482 }
14483 ApplyAnyObjectLogic(exp);
14484 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14485 {
14486 exp->byReference = 0x1;
14487 }
14488 yylloc = oldyylloc;
14489 }
14490
14491 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)
14492 {
14493 if(*curMember)
14494 {
14495 *curMember = (*curMember)->next;
14496 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14497 {
14498 *curMember = subMemberStack[--(*subMemberStackPos)];
14499 *curMember = (*curMember)->next;
14500 }
14501 while((*curMember) && (*curMember)->isProperty)
14502 *curMember = (*curMember)->next;
14503 if(subMemberStackPos)
14504 {
14505 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14506 {
14507 subMemberStack[(*subMemberStackPos)++] = *curMember;
14508 *curMember = (*curMember)->members.first;
14509 while(*curMember && (*curMember)->isProperty)
14510 *curMember = (*curMember)->next;
14511 }
14512 }
14513 }
14514 while(!*curMember)
14515 {
14516 if(!*curMember)
14517 {
14518 if(subMemberStackPos && *subMemberStackPos)
14519 {
14520 *curMember = subMemberStack[--(*subMemberStackPos)];
14521 *curMember = (*curMember)->next;
14522 }
14523 else
14524 {
14525 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
14526
14527 if(*curClass == _class)
14528 break;
14529 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
14530 ;
14531 *curMember = (*curClass)->membersAndProperties.first;
14532 }
14533 while((*curMember) && (*curMember)->isProperty)
14534 *curMember = (*curMember)->next;
14535 if(subMemberStackPos)
14536 {
14537 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14538 {
14539 subMemberStack[(*subMemberStackPos)++] = *curMember;
14540 *curMember = (*curMember)->members.first;
14541 while(*curMember && (*curMember)->isProperty)
14542 *curMember = (*curMember)->next;
14543 }
14544 }
14545 }
14546 }
14547 }
14548
14549 static void ProcessInitializer(struct Initializer * init, struct Type * type)
14550 {
14551 switch(init->type)
14552 {
14553 case 0:
14554 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
14555 {
14556 if(init->exp && !init->exp->destType)
14557 {
14558 FreeType(init->exp->destType);
14559 init->exp->destType = type;
14560 if(type)
14561 type->refCount++;
14562 }
14563 if(init->exp)
14564 {
14565 ProcessExpressionType(init->exp);
14566 init->isConstant = init->exp->isConstant;
14567 }
14568 break;
14569 }
14570 else
14571 {
14572 struct Expression * exp = init->exp;
14573 struct Instantiation * inst = exp->instance;
14574 struct MembersInit * members;
14575
14576 init->type = 1;
14577 init->list = MkList();
14578 if(inst->members)
14579 {
14580 for(members = (*inst->members).first; members; members = members->next)
14581 {
14582 if(members->type == 0)
14583 {
14584 struct MemberInit * member;
14585
14586 for(member = (*members->dataMembers).first; member; member = member->next)
14587 {
14588 ListAdd(init->list, member->initializer);
14589 member->initializer = (((void *)0));
14590 }
14591 }
14592 }
14593 }
14594 FreeExpression(exp);
14595 }
14596 case 1:
14597 {
14598 struct Initializer * i;
14599 struct Type * initializerType = (((void *)0));
14600 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
14601 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
14602 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
14603 int subMemberStackPos = 0;
14604
14605 if(type && type->kind == 12)
14606 initializerType = Dereference(type);
14607 else if(type && (type->kind == 9 || type->kind == 10))
14608 initializerType = type->members.first;
14609 for(i = (*init->list).first; i; i = i->next)
14610 {
14611 if(type && type->kind == 8 && type->_class && type->_class->registered)
14612 {
14613 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
14614 if(curMember)
14615 {
14616 if(!curMember->dataType)
14617 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
14618 initializerType = curMember->dataType;
14619 }
14620 }
14621 ProcessInitializer(i, initializerType);
14622 if(initializerType && type && (type->kind == 9 || type->kind == 10))
14623 initializerType = initializerType->next;
14624 if(!i->isConstant)
14625 init->isConstant = 0x0;
14626 }
14627 if(type && type->kind == 12)
14628 FreeType(initializerType);
14629 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
14630 {
14631 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
14632 }
14633 break;
14634 }
14635 }
14636 }
14637
14638 extern struct Symbol * FindType(struct Context * ctx, char *  name);
14639
14640 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
14641
14642 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
14643 {
14644 switch(spec->type)
14645 {
14646 case 0:
14647 {
14648 if(spec->specifier == THISCLASS)
14649 {
14650 if(thisClass)
14651 {
14652 spec->type = 1;
14653 spec->name = ReplaceThisClass(thisClass);
14654 spec->symbol = FindClass(spec->name);
14655 ProcessSpecifier(spec, declareStruct);
14656 }
14657 }
14658 break;
14659 }
14660 case 1:
14661 {
14662 struct Symbol * symbol = FindType(curContext, spec->name);
14663
14664 if(symbol)
14665 DeclareType(symbol->type, 0x1, 0x1);
14666 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
14667 DeclareStruct(spec->name, 0x0);
14668 break;
14669 }
14670 case 2:
14671 {
14672 struct Enumerator * e;
14673
14674 if(spec->list)
14675 {
14676 for(e = (*spec->list).first; e; e = e->next)
14677 {
14678 if(e->exp)
14679 ProcessExpressionType(e->exp);
14680 }
14681 }
14682 break;
14683 }
14684 case 3:
14685 case 4:
14686 {
14687 if(spec->definitions)
14688 {
14689 struct ClassDef * def;
14690 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
14691
14692 ProcessClass(spec->definitions, symbol);
14693 }
14694 break;
14695 }
14696 }
14697 }
14698
14699 static void ProcessDeclarator(struct Declarator * decl)
14700 {
14701 switch(decl->type)
14702 {
14703 case 1:
14704 if(decl->identifier->classSym)
14705 {
14706 FreeSpecifier(decl->identifier->_class);
14707 decl->identifier->_class = (((void *)0));
14708 }
14709 break;
14710 case 3:
14711 if(decl->array.exp)
14712 ProcessExpressionType(decl->array.exp);
14713 case 0:
14714 case 2:
14715 case 4:
14716 case 5:
14717 case 6:
14718 case 7:
14719 if(decl->declarator)
14720 ProcessDeclarator(decl->declarator);
14721 if(decl->type == 4)
14722 {
14723 struct Identifier * id = GetDeclId(decl);
14724
14725 if(id && id->_class)
14726 {
14727 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
14728
14729 if(!decl->function.parameters)
14730 decl->function.parameters = MkList();
14731 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
14732 id->_class = (((void *)0));
14733 }
14734 if(decl->function.parameters)
14735 {
14736 struct TypeName * param;
14737
14738 for(param = (*decl->function.parameters).first; param; param = param->next)
14739 {
14740 if(param->qualifiers && (*param->qualifiers).first)
14741 {
14742 struct Specifier * spec = (*param->qualifiers).first;
14743
14744 if(spec && spec->specifier == TYPED_OBJECT)
14745 {
14746 struct Declarator * d = param->declarator;
14747 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);
14748
14749 FreeList(param->qualifiers, FreeSpecifier);
14750 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
14751 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
14752 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
14753 param = newParam;
14754 }
14755 else if(spec && spec->specifier == ANY_OBJECT)
14756 {
14757 struct Declarator * d = param->declarator;
14758
14759 FreeList(param->qualifiers, FreeSpecifier);
14760 param->qualifiers = MkListOne(MkSpecifier(VOID));
14761 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
14762 }
14763 else if(spec->specifier == THISCLASS)
14764 {
14765 if(thisClass)
14766 {
14767 spec->type = 1;
14768 spec->name = ReplaceThisClass(thisClass);
14769 spec->symbol = FindClass(spec->name);
14770 ProcessSpecifier(spec, 0x0);
14771 }
14772 }
14773 }
14774 if(param->declarator)
14775 ProcessDeclarator(param->declarator);
14776 }
14777 }
14778 }
14779 break;
14780 }
14781 }
14782
14783 extern struct Identifier * CopyIdentifier(struct Identifier * id);
14784
14785 extern void FreeInitDeclarator(struct InitDeclarator * decl);
14786
14787 static void ProcessDeclaration(struct Declaration * decl)
14788 {
14789 yylloc = decl->loc;
14790 switch(decl->type)
14791 {
14792 case 1:
14793 {
14794 unsigned int declareStruct = 0x0;
14795
14796 if(decl->declarators)
14797 {
14798 struct InitDeclarator * d;
14799
14800 for(d = (*decl->declarators).first; d; d = d->next)
14801 {
14802 struct Type * type, * subType;
14803
14804 ProcessDeclarator(d->declarator);
14805 type = ProcessType(decl->specifiers, d->declarator);
14806 if(d->initializer)
14807 {
14808 ProcessInitializer(d->initializer, type);
14809 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
14810 {
14811 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
14812 {
14813 struct Instantiation * inst = d->initializer->exp->instance;
14814
14815 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
14816 d->initializer->exp->instance = (((void *)0));
14817 if(decl->specifiers)
14818 FreeList(decl->specifiers, FreeSpecifier);
14819 FreeList(decl->declarators, FreeInitDeclarator);
14820 d = (((void *)0));
14821 decl->type = 2;
14822 decl->inst = inst;
14823 }
14824 }
14825 }
14826 for(subType = type; subType; )
14827 {
14828 if(subType->kind == 8)
14829 {
14830 declareStruct = 0x1;
14831 break;
14832 }
14833 else if(subType->kind == 13)
14834 break;
14835 else if(subType->kind == 12)
14836 subType = subType->arrayType;
14837 else
14838 break;
14839 }
14840 FreeType(type);
14841 if(!d)
14842 break;
14843 }
14844 }
14845 if(decl->specifiers)
14846 {
14847 struct Specifier * s;
14848
14849 for(s = (*decl->specifiers).first; s; s = s->next)
14850 {
14851 ProcessSpecifier(s, declareStruct);
14852 }
14853 }
14854 break;
14855 }
14856 case 2:
14857 {
14858 ProcessInstantiationType(decl->inst);
14859 break;
14860 }
14861 case 0:
14862 {
14863 struct Specifier * spec;
14864 struct Declarator * d;
14865 unsigned int declareStruct = 0x0;
14866
14867 if(decl->declarators)
14868 {
14869 for(d = (*decl->declarators).first; d; d = d->next)
14870 {
14871 struct Type * type = ProcessType(decl->specifiers, d->declarator);
14872 struct Type * subType;
14873
14874 ProcessDeclarator(d);
14875 for(subType = type; subType; )
14876 {
14877 if(subType->kind == 8)
14878 {
14879 declareStruct = 0x1;
14880 break;
14881 }
14882 else if(subType->kind == 13)
14883 break;
14884 else if(subType->kind == 12)
14885 subType = subType->arrayType;
14886 else
14887 break;
14888 }
14889 FreeType(type);
14890 }
14891 }
14892 if(decl->specifiers)
14893 {
14894 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
14895 ProcessSpecifier(spec, declareStruct);
14896 }
14897 break;
14898 }
14899 }
14900 }
14901
14902 static struct FunctionDefinition * curFunction;
14903
14904 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
14905 {
14906 char propName[1024], propNameM[1024];
14907 char getName[1024], setName[1024];
14908 struct __ecereNameSpace__ecere__sys__OldList * args;
14909
14910 DeclareProperty(prop, setName, getName);
14911 strcpy(propName, "__ecereProp_");
14912 FullClassNameCat(propName, prop->_class->fullName, 0x0);
14913 strcat(propName, "_");
14914 FullClassNameCat(propName, prop->name, 0x1);
14915 MangleClassName(propName);
14916 strcpy(propNameM, "__ecerePropM_");
14917 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
14918 strcat(propNameM, "_");
14919 FullClassNameCat(propNameM, prop->name, 0x1);
14920 MangleClassName(propNameM);
14921 if(prop->isWatchable)
14922 {
14923 args = MkList();
14924 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14925 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
14926 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
14927 args = MkList();
14928 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14929 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
14930 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
14931 }
14932 {
14933 args = MkList();
14934 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14935 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
14936 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
14937 args = MkList();
14938 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14939 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
14940 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
14941 }
14942 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
14943 curFunction->propSet->fireWatchersDone = 0x1;
14944 }
14945
14946 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
14947
14948 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
14949
14950 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
14951
14952 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
14953
14954 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
14955
14956 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
14957
14958 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
14959
14960 extern void FreePropertyWatch(struct PropertyWatch * watcher);
14961
14962 static void ProcessStatement(struct Statement * stmt)
14963 {
14964 yylloc = stmt->loc;
14965 switch(stmt->type)
14966 {
14967 case 0:
14968 ProcessStatement(stmt->labeled.stmt);
14969 break;
14970 case 1:
14971 if(stmt->caseStmt.exp)
14972 {
14973 FreeType(stmt->caseStmt.exp->destType);
14974 stmt->caseStmt.exp->destType = curSwitchType;
14975 if(curSwitchType)
14976 curSwitchType->refCount++;
14977 ProcessExpressionType(stmt->caseStmt.exp);
14978 ComputeExpression(stmt->caseStmt.exp);
14979 }
14980 if(stmt->caseStmt.stmt)
14981 ProcessStatement(stmt->caseStmt.stmt);
14982 break;
14983 case 2:
14984 {
14985 if(stmt->compound.context)
14986 {
14987 struct Declaration * decl;
14988 struct Statement * s;
14989 struct Statement * prevCompound = curCompound;
14990 struct Context * prevContext = curContext;
14991
14992 if(!stmt->compound.isSwitch)
14993 {
14994 curCompound = stmt;
14995 curContext = stmt->compound.context;
14996 }
14997 if(stmt->compound.declarations)
14998 {
14999 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15000 ProcessDeclaration(decl);
15001 }
15002 if(stmt->compound.statements)
15003 {
15004 for(s = (*stmt->compound.statements).first; s; s = s->next)
15005 ProcessStatement(s);
15006 }
15007 curContext = prevContext;
15008 curCompound = prevCompound;
15009 }
15010 break;
15011 }
15012 case 3:
15013 {
15014 struct Expression * exp;
15015
15016 if(stmt->expressions)
15017 {
15018 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15019 ProcessExpressionType(exp);
15020 }
15021 break;
15022 }
15023 case 4:
15024 {
15025 struct Expression * exp;
15026
15027 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15028 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15029 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15030 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15031 {
15032 ProcessExpressionType(exp);
15033 }
15034 if(stmt->ifStmt.stmt)
15035 ProcessStatement(stmt->ifStmt.stmt);
15036 if(stmt->ifStmt.elseStmt)
15037 ProcessStatement(stmt->ifStmt.elseStmt);
15038 break;
15039 }
15040 case 5:
15041 {
15042 struct Type * oldSwitchType = curSwitchType;
15043
15044 if(stmt->switchStmt.exp)
15045 {
15046 struct Expression * exp;
15047
15048 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15049 {
15050 if(!exp->next)
15051 {
15052 ProcessExpressionType(exp);
15053 }
15054 if(!exp->next)
15055 curSwitchType = exp->expType;
15056 }
15057 }
15058 ProcessStatement(stmt->switchStmt.stmt);
15059 curSwitchType = oldSwitchType;
15060 break;
15061 }
15062 case 6:
15063 {
15064 if(stmt->whileStmt.exp)
15065 {
15066 struct Expression * exp;
15067
15068 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15069 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15070 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15071 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15072 {
15073 ProcessExpressionType(exp);
15074 }
15075 }
15076 if(stmt->whileStmt.stmt)
15077 ProcessStatement(stmt->whileStmt.stmt);
15078 break;
15079 }
15080 case 7:
15081 {
15082 if(stmt->doWhile.exp)
15083 {
15084 struct Expression * exp;
15085
15086 if((*stmt->doWhile.exp).last)
15087 {
15088 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15089 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15090 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15091 }
15092 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15093 {
15094 ProcessExpressionType(exp);
15095 }
15096 }
15097 if(stmt->doWhile.stmt)
15098 ProcessStatement(stmt->doWhile.stmt);
15099 break;
15100 }
15101 case 8:
15102 {
15103 struct Expression * exp;
15104
15105 if(stmt->forStmt.init)
15106 ProcessStatement(stmt->forStmt.init);
15107 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15108 {
15109 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15110 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15111 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15112 }
15113 if(stmt->forStmt.check)
15114 ProcessStatement(stmt->forStmt.check);
15115 if(stmt->forStmt.increment)
15116 {
15117 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15118 ProcessExpressionType(exp);
15119 }
15120 if(stmt->forStmt.stmt)
15121 ProcessStatement(stmt->forStmt.stmt);
15122 break;
15123 }
15124 case 18:
15125 {
15126 struct Identifier * id = stmt->forEachStmt.id;
15127 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15128 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15129 struct Statement * block = stmt->forEachStmt.stmt;
15130 char iteratorType[1024];
15131 struct Type * source;
15132 struct Expression * e;
15133 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));
15134 struct Expression * arrayExp;
15135 char * typeString = (((void *)0));
15136 int builtinCount = 0;
15137
15138 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15139 {
15140 if(!e->next)
15141 {
15142 FreeType(e->destType);
15143 e->destType = ProcessTypeString("Container", 0x0);
15144 }
15145 if(!isBuiltin || e->next)
15146 ProcessExpressionType(e);
15147 }
15148 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15149 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15150 {
15151 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15152 struct Symbol * symbol;
15153 struct Expression * expIt = (((void *)0));
15154 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15155 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15156 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15157 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15158
15159 stmt->type = 2;
15160 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15161 stmt->compound.context->parent = curContext;
15162 curContext = stmt->compound.context;
15163 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15164 {
15165 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15166 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15167
15168 isCustomAVLTree = 0x1;
15169 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15170 isAVLTree = 0x1;
15171 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15172 isMap = 0x1;
15173 }
15174 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15175 isArray = 0x1;
15176 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15177 {
15178 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15179
15180 isLinkList = 0x1;
15181 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15182 }
15183 if(isArray)
15184 {
15185 struct Declarator * decl;
15186 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15187
15188 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15189 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15190 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15191 }
15192 else if(isBuiltin)
15193 {
15194 struct Type * type = (((void *)0));
15195 char typeStringBuf[1024];
15196
15197 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15198 if(((struct Expression *)(*exp).last)->type == 11)
15199 {
15200 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15201
15202 if(typeName)
15203 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15204 }
15205 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)
15206 {
15207 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15208
15209 typeString = templateClass->templateArgs[2].dataTypeString;
15210 }
15211 else if(arrayExp->list)
15212 {
15213 struct Expression * e;
15214
15215 for(e = (*arrayExp->list).first; e; e = e->next)
15216 {
15217 ProcessExpressionType(e);
15218 if(e->expType)
15219 {
15220 if(!type)
15221 {
15222 type = e->expType;
15223 type->refCount++;
15224 }
15225 else
15226 {
15227 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15228 {
15229 FreeType(type);
15230 type = e->expType;
15231 e->expType = (((void *)0));
15232 e = (*arrayExp->list).first;
15233 ProcessExpressionType(e);
15234 if(e->expType)
15235 {
15236 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15237 {
15238 FreeType(e->expType);
15239 e->expType = (((void *)0));
15240 FreeType(type);
15241 type = (((void *)0));
15242 break;
15243 }
15244 }
15245 }
15246 }
15247 if(e->expType)
15248 {
15249 FreeType(e->expType);
15250 e->expType = (((void *)0));
15251 }
15252 }
15253 }
15254 if(type)
15255 {
15256 typeStringBuf[0] = '\0';
15257 PrintType(type, typeStringBuf, 0x0, 0x1);
15258 typeString = typeStringBuf;
15259 FreeType(type);
15260 }
15261 }
15262 if(typeString)
15263 {
15264 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15265 struct Declarator * decl;
15266 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15267
15268 if(arrayExp->list)
15269 {
15270 struct Expression * e;
15271
15272 builtinCount = (*arrayExp->list).count;
15273 type = ProcessTypeString(typeString, 0x0);
15274 while(e = (*arrayExp->list).first)
15275 {
15276 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15277 e->destType = type;
15278 type->refCount++;
15279 ProcessExpressionType(e);
15280 ListAdd(initializers, MkInitializerAssignment(e));
15281 }
15282 FreeType(type);
15283 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15284 }
15285 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15286 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15287 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15288 FreeList(exp, FreeExpression);
15289 }
15290 else
15291 {
15292 arrayExp->expType = ProcessTypeString("Container", 0x0);
15293 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15294 }
15295 }
15296 else if(isLinkList && !isList)
15297 {
15298 struct Declarator * decl;
15299 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15300
15301 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15302 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15303 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15304 }
15305 else if(_class->templateArgs)
15306 {
15307 if(isMap)
15308 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15309 else
15310 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15311 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15312 }
15313 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15314 if(block && block->type == 2 && block->compound.context)
15315 {
15316 block->compound.context->parent = stmt->compound.context;
15317 }
15318 if(filter)
15319 {
15320 block = MkIfStmt(filter, block, (((void *)0)));
15321 }
15322 if(isArray)
15323 {
15324 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));
15325 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15326 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15327 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15328 }
15329 else if(isBuiltin)
15330 {
15331 char count[128];
15332
15333 sprintf(count, "%d", builtinCount);
15334 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));
15335 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15336 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15337 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15338 }
15339 else if(isLinkList && !isList)
15340 {
15341 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15342 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15343
15344 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15345 {
15346 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));
15347 }
15348 else
15349 {
15350 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15351 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15352
15353 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));
15354 }
15355 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15356 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15357 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15358 }
15359 else
15360 {
15361 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15362 }
15363 ProcessExpressionType(expIt);
15364 if((*stmt->compound.declarations).first)
15365 ProcessDeclaration((*stmt->compound.declarations).first);
15366 if(symbol)
15367 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15368 ProcessStatement(stmt);
15369 curContext = stmt->compound.context->parent;
15370 break;
15371 }
15372 else
15373 {
15374 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15375 }
15376 break;
15377 }
15378 case 9:
15379 break;
15380 case 10:
15381 break;
15382 case 11:
15383 break;
15384 case 12:
15385 {
15386 struct Expression * exp;
15387
15388 if(stmt->expressions)
15389 {
15390 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15391 {
15392 if(!exp->next)
15393 {
15394 if(curFunction && !curFunction->type)
15395 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15396 FreeType(exp->destType);
15397 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15398 if(exp->destType)
15399 exp->destType->refCount++;
15400 }
15401 ProcessExpressionType(exp);
15402 }
15403 }
15404 break;
15405 }
15406 case 14:
15407 {
15408 ProcessDeclaration(stmt->decl);
15409 break;
15410 }
15411 case 13:
15412 {
15413 struct AsmField * field;
15414
15415 if(stmt->asmStmt.inputFields)
15416 {
15417 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15418 if(field->expression)
15419 ProcessExpressionType(field->expression);
15420 }
15421 if(stmt->asmStmt.outputFields)
15422 {
15423 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15424 if(field->expression)
15425 ProcessExpressionType(field->expression);
15426 }
15427 if(stmt->asmStmt.clobberedFields)
15428 {
15429 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15430 {
15431 if(field->expression)
15432 ProcessExpressionType(field->expression);
15433 }
15434 }
15435 break;
15436 }
15437 case 17:
15438 {
15439 struct PropertyWatch * propWatch;
15440 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15441 struct Expression * object = stmt->_watch.object;
15442 struct Expression * watcher = stmt->_watch.watcher;
15443
15444 if(watcher)
15445 ProcessExpressionType(watcher);
15446 if(object)
15447 ProcessExpressionType(object);
15448 if(inCompiler)
15449 {
15450 if(watcher || thisClass)
15451 {
15452 struct External * external = curExternal;
15453 struct Context * context = curContext;
15454
15455 stmt->type = 3;
15456 stmt->expressions = MkList();
15457 curExternal = external->prev;
15458 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15459 {
15460 struct ClassFunction * func;
15461 char watcherName[1024];
15462 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15463 struct External * createdExternal;
15464 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15465
15466 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15467 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15468 if(propWatch->deleteWatch)
15469 strcat(watcherName, "_delete");
15470 else
15471 {
15472 struct Identifier * propID;
15473
15474 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15475 {
15476 strcat(watcherName, "_");
15477 strcat(watcherName, propID->string);
15478 }
15479 }
15480 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15481 {
15482 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15483 ProcessClassFunctionBody(func, propWatch->compound);
15484 propWatch->compound = (((void *)0));
15485 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15486 createdExternal->symbol->idCode = external->symbol->idCode;
15487 curExternal = createdExternal;
15488 ProcessFunction(createdExternal->function);
15489 {
15490 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15491
15492 externalDecl->declaration = decl;
15493 if(decl->symbol && !decl->symbol->pointerExternal)
15494 decl->symbol->pointerExternal = externalDecl;
15495 }
15496 if(propWatch->deleteWatch)
15497 {
15498 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15499
15500 ListAdd(args, CopyExpression(object));
15501 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15502 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15503 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
15504 }
15505 else
15506 {
15507 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
15508 struct Identifier * propID;
15509
15510 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15511 {
15512 char propName[1024];
15513 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15514
15515 if(prop)
15516 {
15517 char getName[1024], setName[1024];
15518 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15519
15520 DeclareProperty(prop, setName, getName);
15521 strcpy(propName, "__ecereProp_");
15522 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15523 strcat(propName, "_");
15524 FullClassNameCat(propName, prop->name, 0x1);
15525 ListAdd(args, CopyExpression(object));
15526 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15527 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15528 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15529 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
15530 }
15531 else
15532 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15533 }
15534 }
15535 }
15536 else
15537 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
15538 }
15539 curExternal = external;
15540 curContext = context;
15541 if(watcher)
15542 FreeExpression(watcher);
15543 if(object)
15544 FreeExpression(object);
15545 FreeList(watches, FreePropertyWatch);
15546 }
15547 else
15548 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
15549 }
15550 else
15551 {
15552 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15553 {
15554 ProcessStatement(propWatch->compound);
15555 }
15556 }
15557 break;
15558 }
15559 case 15:
15560 {
15561 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15562 struct Expression * object = stmt->_watch.object;
15563 struct __ecereNameSpace__ecere__com__Class * _class;
15564
15565 if(object)
15566 ProcessExpressionType(object);
15567 if(inCompiler)
15568 {
15569 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
15570 if(_class)
15571 {
15572 struct Identifier * propID;
15573
15574 stmt->type = 3;
15575 stmt->expressions = MkList();
15576 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15577 {
15578 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
15579 }
15580 else if(!watches)
15581 {
15582 }
15583 if(watches)
15584 {
15585 for(propID = (*watches).first; propID; propID = propID->next)
15586 {
15587 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15588
15589 if(prop)
15590 {
15591 CreateFireWatcher(prop, object, stmt);
15592 }
15593 else
15594 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
15595 }
15596 }
15597 else
15598 {
15599 struct __ecereNameSpace__ecere__com__Property * prop;
15600 struct __ecereNameSpace__ecere__com__Class * base;
15601
15602 for(base = _class; base; base = base->base)
15603 {
15604 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
15605 {
15606 if(prop->isProperty && prop->isWatchable)
15607 {
15608 CreateFireWatcher(prop, object, stmt);
15609 }
15610 }
15611 }
15612 }
15613 if(object)
15614 FreeExpression(object);
15615 FreeList(watches, FreeIdentifier);
15616 }
15617 else
15618 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15619 }
15620 break;
15621 }
15622 case 16:
15623 {
15624 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15625 struct Expression * object = stmt->_watch.object;
15626 struct Expression * watcher = stmt->_watch.watcher;
15627 struct __ecereNameSpace__ecere__com__Class * _class;
15628
15629 if(object)
15630 ProcessExpressionType(object);
15631 if(watcher)
15632 ProcessExpressionType(watcher);
15633 if(inCompiler)
15634 {
15635 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
15636 if(watcher || thisClass)
15637 {
15638 if(_class)
15639 {
15640 struct Identifier * propID;
15641
15642 stmt->type = 3;
15643 stmt->expressions = MkList();
15644 if(!watches)
15645 {
15646 struct __ecereNameSpace__ecere__sys__OldList * args;
15647
15648 args = MkList();
15649 ListAdd(args, CopyExpression(object));
15650 ListAdd(args, MkExpConstant("0"));
15651 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15652 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15653 }
15654 else
15655 {
15656 for(propID = (*watches).first; propID; propID = propID->next)
15657 {
15658 char propName[1024];
15659 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15660
15661 if(prop)
15662 {
15663 char getName[1024], setName[1024];
15664 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15665
15666 DeclareProperty(prop, setName, getName);
15667 strcpy(propName, "__ecereProp_");
15668 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15669 strcat(propName, "_");
15670 FullClassNameCat(propName, prop->name, 0x1);
15671 MangleClassName(propName);
15672 ListAdd(args, CopyExpression(object));
15673 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15674 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15675 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15676 }
15677 else
15678 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15679 }
15680 }
15681 if(object)
15682 FreeExpression(object);
15683 if(watcher)
15684 FreeExpression(watcher);
15685 FreeList(watches, FreeIdentifier);
15686 }
15687 else
15688 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15689 }
15690 else
15691 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
15692 }
15693 break;
15694 }
15695 }
15696 }
15697
15698 extern struct Expression * QBrackets(struct Expression * exp);
15699
15700 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
15701
15702 extern struct Declarator * QMkPtrDecl(char *  id);
15703
15704 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
15705
15706 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
15707
15708 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
15709
15710 static void ProcessFunction(struct FunctionDefinition * function)
15711 {
15712 void * __ecereTemp2;
15713 void * __ecereTemp1;
15714 struct Identifier * id = GetDeclId(function->declarator);
15715 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
15716 struct Type * type = symbol ? symbol->type : (((void *)0));
15717 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
15718 struct Context * oldTopContext = topContext;
15719
15720 yylloc = function->loc;
15721 if(type && type->thisClass)
15722 {
15723 struct Symbol * classSym = type->thisClass;
15724 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
15725 char className[1024];
15726 char structName[1024];
15727 struct Declarator * funcDecl;
15728 struct Symbol * thisSymbol;
15729 unsigned int typedObject = 0x0;
15730
15731 if(_class && !_class->base)
15732 {
15733 _class = currentClass;
15734 if(_class && !_class->symbol)
15735 _class->symbol = FindClass(_class->fullName);
15736 classSym = _class ? _class->symbol : (((void *)0));
15737 typedObject = 0x1;
15738 }
15739 thisClass = _class;
15740 if(inCompiler && _class)
15741 {
15742 if(type->kind == 11)
15743 {
15744 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
15745 {
15746 struct Type * param = symbol->type->params.first;
15747
15748 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
15749 FreeType(param);
15750 }
15751 if(type->classObjectType != 1)
15752 {
15753 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
15754 symbol->type->staticMethod = 0x1;
15755 symbol->type->thisClass = (((void *)0));
15756 symbol->type->extraParam = 0x0;
15757 }
15758 }
15759 strcpy(className, "__ecereClass_");
15760 FullClassNameCat(className, _class->fullName, 0x1);
15761 MangleClassName(className);
15762 structName[0] = (char)0;
15763 FullClassNameCat(structName, _class->fullName, 0x0);
15764 funcDecl = GetFuncDecl(function->declarator);
15765 if(funcDecl)
15766 {
15767 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15768 {
15769 struct TypeName * param = (*funcDecl->function.parameters).first;
15770
15771 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
15772 {
15773 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15774 FreeTypeName(param);
15775 }
15776 }
15777 if(!function->propertyNoThis)
15778 {
15779 struct TypeName * thisParam;
15780
15781 if(type->classObjectType != 1)
15782 {
15783 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15784 if(!funcDecl->function.parameters)
15785 funcDecl->function.parameters = MkList();
15786 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15787 }
15788 if(typedObject)
15789 {
15790 if(type->classObjectType != 1)
15791 {
15792 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
15793 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
15794 }
15795 thisParam = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), ((struct TypeName *)__ecereTemp1)->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), ((struct TypeName *)__ecereTemp1)->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), ((struct TypeName *)__ecereTemp1));
15796 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15797 }
15798 }
15799 }
15800 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
15801 {
15802 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
15803
15804 funcDecl = GetFuncDecl(initDecl->declarator);
15805 if(funcDecl)
15806 {
15807 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15808 {
15809 struct TypeName * param = (*funcDecl->function.parameters).first;
15810
15811 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
15812 {
15813 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15814 FreeTypeName(param);
15815 }
15816 }
15817 if(type->classObjectType != 1)
15818 {
15819 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
15820 {
15821 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15822
15823 if(!funcDecl->function.parameters)
15824 funcDecl->function.parameters = MkList();
15825 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15826 }
15827 }
15828 }
15829 }
15830 }
15831 if(function->body)
15832 {
15833 if(type->classObjectType != 1)
15834 {
15835 thisSymbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString("this"), ((struct Symbol *)__ecereTemp1)->type = classSym ? MkClassType(classSym->string) : (((void *)0)), ((struct Symbol *)__ecereTemp1));
15836 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15837 if(typedObject && thisSymbol->type)
15838 {
15839 thisSymbol->type->classObjectType = 2;
15840 thisSymbol->type->byReference = type->byReference;
15841 }
15842 }
15843 }
15844 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
15845 {
15846 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
15847
15848 {
15849 struct __ecereNameSpace__ecere__com__Class * base;
15850
15851 for(base = _class; base && base->type != 1000; base = base->next)
15852 {
15853 for(member = base->membersAndProperties.first; member; member = member->next)
15854 if(!member->isProperty)
15855 break;
15856 if(member)
15857 break;
15858 }
15859 }
15860 for(member = _class->membersAndProperties.first; member; member = member->next)
15861 if(!member->isProperty)
15862 break;
15863 if(member)
15864 {
15865 char pointerName[1024];
15866 struct Declaration * decl;
15867 struct Initializer * initializer;
15868 struct Expression * exp, * bytePtr;
15869
15870 strcpy(pointerName, "__ecerePointer_");
15871 FullClassNameCat(pointerName, _class->fullName, 0x0);
15872 {
15873 char className[1024];
15874
15875 strcpy(className, "__ecereClass_");
15876 FullClassNameCat(className, classSym->string, 0x1);
15877 MangleClassName(className);
15878 DeclareClass(classSym, className);
15879 }
15880 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
15881 if(_class->fixed)
15882 {
15883 char string[256];
15884
15885 sprintf(string, "%d", _class->offset);
15886 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
15887 }
15888 else
15889 {
15890 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
15891 }
15892 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
15893 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 0, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
15894 if(function->body)
15895 {
15896 yylloc = function->body->loc;
15897 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
15898 {
15899 struct Context * prevContext = curContext;
15900
15901 curContext = function->body->compound.context;
15902 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
15903 curContext = prevContext;
15904 }
15905 decl->symbol = (((void *)0));
15906 if(!function->body->compound.declarations)
15907 function->body->compound.declarations = MkList();
15908 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
15909 }
15910 }
15911 }
15912 }
15913 else
15914 thisClass = (((void *)0));
15915 if(id)
15916 {
15917 FreeSpecifier(id->_class);
15918 id->_class = (((void *)0));
15919 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
15920 {
15921 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
15922
15923 id = GetDeclId(initDecl->declarator);
15924 FreeSpecifier(id->_class);
15925 id->_class = (((void *)0));
15926 }
15927 }
15928 if(function->body)
15929 topContext = function->body->compound.context;
15930 {
15931 struct FunctionDefinition * oldFunction = curFunction;
15932
15933 curFunction = function;
15934 if(function->body)
15935 ProcessStatement(function->body);
15936 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
15937 {
15938 struct Statement * prevCompound = curCompound;
15939 struct Context * prevContext = curContext;
15940 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
15941
15942 if(!function->body->compound.statements)
15943 function->body->compound.statements = MkList();
15944 ListAdd(function->body->compound.statements, fireWatchers);
15945 curCompound = function->body;
15946 curContext = function->body->compound.context;
15947 ProcessStatement(fireWatchers);
15948 curContext = prevContext;
15949 curCompound = prevCompound;
15950 }
15951 curFunction = oldFunction;
15952 }
15953 if(function->declarator)
15954 {
15955 ProcessDeclarator(function->declarator);
15956 }
15957 topContext = oldTopContext;
15958 thisClass = oldThisClass;
15959 }
15960
15961 extern void FreeSymbol(struct Symbol * symbol);
15962
15963 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
15964
15965 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
15966 {
15967 struct ClassDef * def;
15968 struct External * external = curExternal;
15969 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
15970
15971 for(def = definitions->first; def; def = def->next)
15972 {
15973 if(def->type == 0)
15974 {
15975 if(def->function->declarator)
15976 curExternal = def->function->declarator->symbol->pointerExternal;
15977 else
15978 curExternal = external;
15979 ProcessFunction((struct FunctionDefinition *)def->function);
15980 }
15981 else if(def->type == 2)
15982 {
15983 if(def->decl->type == 2)
15984 {
15985 thisClass = regClass;
15986 ProcessInstantiationType(def->decl->inst);
15987 thisClass = (((void *)0));
15988 }
15989 else
15990 {
15991 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
15992
15993 if(regClass)
15994 thisClass = regClass;
15995 ProcessDeclaration(def->decl);
15996 thisClass = backThisClass;
15997 }
15998 }
15999 else if(def->type == 1 && def->defProperties)
16000 {
16001 struct MemberInit * defProperty;
16002 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);
16003
16004 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16005 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16006 {
16007 thisClass = regClass;
16008 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16009 thisClass = (((void *)0));
16010 }
16011 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16012 FreeSymbol(thisSymbol);
16013 }
16014 else if(def->type == 3 && def->propertyDef)
16015 {
16016 struct PropertyDef * prop = def->propertyDef;
16017
16018 thisClass = regClass;
16019 if(prop->setStmt)
16020 {
16021 if(regClass)
16022 {
16023 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16024
16025 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16026 }
16027 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16028 ProcessStatement(prop->setStmt);
16029 }
16030 if(prop->getStmt)
16031 {
16032 if(regClass)
16033 {
16034 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16035
16036 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16037 }
16038 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16039 ProcessStatement(prop->getStmt);
16040 }
16041 if(prop->issetStmt)
16042 {
16043 if(regClass)
16044 {
16045 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16046
16047 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16048 }
16049 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16050 ProcessStatement(prop->issetStmt);
16051 }
16052 thisClass = (((void *)0));
16053 }
16054 else if(def->type == 4 && def->propertyWatch)
16055 {
16056 struct PropertyWatch * propertyWatch = def->propertyWatch;
16057
16058 thisClass = regClass;
16059 if(propertyWatch->compound)
16060 {
16061 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);
16062
16063 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16064 curExternal = (((void *)0));
16065 ProcessStatement(propertyWatch->compound);
16066 }
16067 thisClass = (((void *)0));
16068 }
16069 }
16070 }
16071
16072 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16073
16074 void ComputeDataTypes()
16075 {
16076 void * __ecereTemp1;
16077 struct External * external;
16078 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16079
16080 currentClass = (((void *)0));
16081 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16082 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
16083 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), (((void *)0)), temp);
16084 curExternal = temp;
16085 DeclareStruct("ecere::com::Class", 0x0);
16086 DeclareStruct("ecere::com::Instance", 0x0);
16087 DeclareStruct("ecere::com::Property", 0x0);
16088 DeclareStruct("ecere::com::DataMember", 0x0);
16089 DeclareStruct("ecere::com::Method", 0x0);
16090 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16091 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16092 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16093 for(external = (*ast).first; external; external = external->next)
16094 {
16095 afterExternal = curExternal = external;
16096 if(external->type == 0)
16097 {
16098 currentClass = external->function->_class;
16099 ProcessFunction(external->function);
16100 }
16101 else if(external->type == 1)
16102 {
16103 currentClass = (((void *)0));
16104 ProcessDeclaration(external->declaration);
16105 }
16106 else if(external->type == 2)
16107 {
16108 struct ClassDefinition * _class = external->_class;
16109
16110 currentClass = external->symbol->registered;
16111 if(_class->definitions)
16112 {
16113 ProcessClass(_class->definitions, _class->symbol);
16114 }
16115 if(inCompiler)
16116 {
16117 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16118 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16119 }
16120 }
16121 else if(external->type == 4)
16122 {
16123 thisNameSpace = external->id->string;
16124 }
16125 }
16126 currentClass = (((void *)0));
16127 thisNameSpace = (((void *)0));
16128 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16129 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16130 }
16131
16132 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);
16133
16134 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (* )(void * ), void (* )(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
16135
16136 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16137 {
16138 struct __ecereNameSpace__ecere__com__Class * class;
16139
16140 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16141 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16142 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16143 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16144 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoi64", "int64 _strtoi64(char * string, char * * endString, int base)", _strtoi64, module, 2);
16145 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoui64", "uint64 _strtoui64(char * string, char * * endString, int base)", _strtoui64, module, 2);
16146 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16147 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16148 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16149 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16150 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16151 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16152 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16153 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16154 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16155 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16156 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16157 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16158 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16159 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16160 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16161 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16162 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16163 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16164 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16165 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16166 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16167 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16168 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16169 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16170 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16171 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16172 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16173 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("AddMembers", "int AddMembers(ecere::sys::OldList * declarations, ecere::com::Class _class, bool isMember, uint * retSize, ecere::com::Class topClass)", AddMembers, module, 2);
16174 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16175 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16176 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16177 __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);
16178 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16179 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16180 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16181 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16182 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16183 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16184 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16185 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16186 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16187 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16188 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16189 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16190 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16191 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
16192 __ecereClass_Conversion = class;
16193 __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);
16194 __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);
16195 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16196 __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);
16197 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16198 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16199 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16200 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16201 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16202 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16203 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16204 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16205 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16206 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16207 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16208 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16209 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16210 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16211 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16212 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16213 }
16214
16215 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16216 {
16217
16218 }
16219