e02d1ae6b1913214cda88bf60d9aa92d17e632cc
[sdk] / compiler / bootstrap / libec / bootstrap / pass0.c
1 /* Code generated from eC source file: pass0.ec */
2 #if defined(_WIN32)
3 #define __runtimePlatform 1
4 #elif defined(__APPLE__)
5 #define __runtimePlatform 3
6 #else
7 #define __runtimePlatform 2
8 #endif
9 #if defined(__GNUC__)
10 typedef long long int64;
11 typedef unsigned long long uint64;
12 #ifndef _WIN32
13 #define __declspec(x)
14 #endif
15 #elif defined(__TINYC__)
16 #include <stdarg.h>
17 #define __builtin_va_list va_list
18 #define __builtin_va_start va_start
19 #define __builtin_va_end va_end
20 #ifdef _WIN32
21 #define strcasecmp stricmp
22 #define strncasecmp strnicmp
23 #define __declspec(x) __attribute__((x))
24 #else
25 #define __declspec(x)
26 #endif
27 typedef long long int64;
28 typedef unsigned long long uint64;
29 #else
30 typedef __int64 int64;
31 typedef unsigned __int64 uint64;
32 #endif
33 #ifdef __BIG_ENDIAN__
34 #define __ENDIAN_PAD(x) (8 - (x))
35 #else
36 #define __ENDIAN_PAD(x) 0
37 #endif
38 #include <stdint.h>
39 #include <sys/types.h>
40 enum yytokentype
41 {
42 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, BOOL = 367, _BOOL = 368, _COMPLEX = 369, _IMAGINARY = 370, RESTRICT = 371, THREAD = 372, WIDE_STRING_LITERAL = 373
43 };
44
45 extern unsigned int inCompiler;
46
47 extern int declMode;
48
49 extern int structDeclMode;
50
51 extern const char *  sourceFile;
52
53 extern struct __ecereNameSpace__ecere__com__Property * __ecereProp_Type_isPointerType;
54
55 struct __ecereNameSpace__ecere__sys__OldList
56 {
57 void *  first;
58 void *  last;
59 int count;
60 unsigned int offset;
61 unsigned int circ;
62 } __attribute__ ((gcc_struct));
63
64 struct __ecereNameSpace__ecere__sys__BTNode;
65
66 struct __ecereNameSpace__ecere__com__DataValue
67 {
68 union
69 {
70 char c;
71 unsigned char uc;
72 short s;
73 unsigned short us;
74 int i;
75 unsigned int ui;
76 void *  p;
77 float f;
78 double d;
79 long long i64;
80 uint64 ui64;
81 } __attribute__ ((gcc_struct)) __anon1;
82 } __attribute__ ((gcc_struct));
83
84 struct __ecereNameSpace__ecere__com__SerialBuffer
85 {
86 unsigned char *  _buffer;
87 unsigned int count;
88 unsigned int _size;
89 unsigned int pos;
90 } __attribute__ ((gcc_struct));
91
92 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
93
94 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
95
96 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
97
98 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
99
100 extern void __ecereNameSpace__ecere__com__eSystem_Delete(void *  memory);
101
102 struct Enumerator;
103
104 struct Pointer;
105
106 struct InitDeclarator;
107
108 struct AsmField;
109
110 struct Attrib;
111
112 struct ExtDecl;
113
114 struct Attribute;
115
116 struct PropertyWatch;
117
118 struct TemplateParameter;
119
120 struct TemplateArgument;
121
122 struct TemplateDatatype;
123
124 struct DBTableEntry;
125
126 struct DBIndexItem;
127
128 struct DBTableDef;
129
130 struct CodePosition
131 {
132 int line;
133 int charPos;
134 int pos;
135 int included;
136 } __attribute__ ((gcc_struct));
137
138 extern char *  strcat(char * , const char * );
139
140 extern size_t strlen(const char * );
141
142 extern int strncmp(const char * , const char * , size_t n);
143
144 struct ModuleImport;
145
146 struct ClassImport;
147
148 extern void Compiler_Error(const char *  format, ...);
149
150 extern const char *  __ecereNameSpace__ecere__GetTranslatedString(const char * name, const char *  string, const char *  stringAndContext);
151
152 struct __ecereNameSpace__ecere__com__LinkList
153 {
154 void * first;
155 void * last;
156 int count;
157 } __attribute__ ((gcc_struct));
158
159 extern char *  __ecereNameSpace__ecere__sys__CopyString(const char *  string);
160
161 extern char *  strcpy(char * , const char * );
162
163 struct __ecereNameSpace__ecere__com__LinkElement
164 {
165 void * prev;
166 void * next;
167 } __attribute__ ((gcc_struct));
168
169 extern char *  strstr(const char * , const char * );
170
171 extern void Compiler_Warning(const char *  format, ...);
172
173 extern int sprintf(char * , const char * , ...);
174
175 struct __ecereNameSpace__ecere__com__GlobalFunction;
176
177 struct __ecereNameSpace__ecere__com__IteratorPointer;
178
179 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
180
181 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
182
183 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
184
185 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
186
187 extern struct __ecereNameSpace__ecere__sys__OldList *  ast;
188
189 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
190
191 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
192
193 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
194
195 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
196
197 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
198
199 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
200
201 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
202
203 extern void FreeInitDeclarator(struct InitDeclarator * decl);
204
205 extern struct Attrib * MkAttrib(int type, struct __ecereNameSpace__ecere__sys__OldList *  attribs);
206
207 extern struct ExtDecl * MkExtDeclAttrib(struct Attrib * attr);
208
209 struct Location
210 {
211 struct CodePosition start;
212 struct CodePosition end;
213 } __attribute__ ((gcc_struct));
214
215 void FullClassNameCat(char * output, const char * className, unsigned int includeTemplateParams)
216 {
217 int c;
218 char ch;
219 int len;
220
221 for(c = 0; (ch = className[c]) && ch != '<'; c++)
222 {
223 if(ch == ':')
224 {
225 strcat(output, "__ecereNameSpace__");
226 break;
227 }
228 }
229 len = strlen(output);
230 c = 0;
231 if(!strncmp(className, "const ", 6))
232 c += 6;
233 for(; (ch = className[c]); c++)
234 {
235 if(ch == ':')
236 output[len++] = '_';
237 else if(ch == ' ')
238 output[len++] = '_';
239 else if(ch == '*')
240 {
241 output[len++] = '_';
242 output[len++] = 'P';
243 output[len++] = 'T';
244 output[len++] = 'R';
245 output[len++] = '_';
246 }
247 else if(ch == '=')
248 {
249 output[len++] = '_';
250 output[len++] = 'E';
251 output[len++] = 'Q';
252 output[len++] = 'U';
253 output[len++] = '_';
254 }
255 else if(ch == '<')
256 {
257 if(!includeTemplateParams)
258 break;
259 if(!strncmp(className + c + 1, "const ", 6))
260 c += 6;
261 output[len++] = '_';
262 output[len++] = 'T';
263 output[len++] = 'P';
264 output[len++] = 'L';
265 output[len++] = '_';
266 }
267 else if(ch == '>')
268 {
269 output[len++] = '_';
270 }
271 else if(ch == ',')
272 {
273 if(!strncmp(className + c + 1, "const ", 6))
274 c += 6;
275 output[len++] = '_';
276 }
277 else
278 output[len++] = ch;
279 }
280 output[len++] = (char)0;
281 }
282
283 extern struct Location yylloc;
284
285 struct External;
286
287 extern struct External * curExternal;
288
289 struct TopoEdge
290 {
291 struct __ecereNameSpace__ecere__com__LinkElement in;
292 struct __ecereNameSpace__ecere__com__LinkElement out;
293 struct External * from;
294 struct External * to;
295 unsigned int breakable;
296 } __attribute__ ((gcc_struct));
297
298 extern void FreeExternal(struct External * external);
299
300 extern struct External * DeclareStruct(struct External * neededBy, const char *  name, unsigned int skipNoHead, unsigned int needDereference);
301
302 struct Context;
303
304 extern struct Context * PushContext(void);
305
306 extern void PopContext(struct Context * ctx);
307
308 extern struct Context * curContext;
309
310 struct __ecereNameSpace__ecere__com__Class;
311
312 struct __ecereNameSpace__ecere__com__Instance
313 {
314 void * *  _vTbl;
315 struct __ecereNameSpace__ecere__com__Class * _class;
316 int _refCount;
317 } __attribute__ ((gcc_struct));
318
319 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name);
320
321 extern void __ecereNameSpace__ecere__com__eClass_SetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, long long value);
322
323 extern int AddMembers(struct External * neededBy, struct __ecereNameSpace__ecere__sys__OldList *  declarations, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember, unsigned int *  retSize, struct __ecereNameSpace__ecere__com__Class * topClass, unsigned int *  addedPadding);
324
325 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
326
327 extern void __ecereNameSpace__ecere__com__eInstance_SetMethod(struct __ecereNameSpace__ecere__com__Instance * instance, const char *  name, void *  function);
328
329 extern void __ecereNameSpace__ecere__com__eInstance_IncRef(struct __ecereNameSpace__ecere__com__Instance * instance);
330
331 int __ecereVMethodID___ecereNameSpace__ecere__com__Container_GetNext;
332
333 struct __ecereNameSpace__ecere__com__Property;
334
335 extern void __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
336
337 extern void __ecereNameSpace__ecere__com__eInstance_StopWatching(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property, struct __ecereNameSpace__ecere__com__Instance * object);
338
339 extern void __ecereNameSpace__ecere__com__eInstance_Watch(void *  instance, struct __ecereNameSpace__ecere__com__Property * _property, void *  object, void (*  callback)(void * , void * ));
340
341 extern void __ecereNameSpace__ecere__com__eInstance_FireWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
342
343 extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_AddProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, const char *  dataType, void *  setStmt, void *  getStmt, int declMode);
344
345 struct Declarator;
346
347 extern void FreeDeclarator(struct Declarator * decl);
348
349 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
350
351 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
352
353 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
354
355 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
356
357 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
358
359 struct __ecereNameSpace__ecere__com__BTNamedLink;
360
361 struct __ecereNameSpace__ecere__com__BTNamedLink
362 {
363 const char *  name;
364 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
365 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
366 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
367 int depth;
368 void *  data;
369 } __attribute__ ((gcc_struct));
370
371 struct Symbol;
372
373 extern struct Symbol * FindClass(const char *  name);
374
375 struct Declaration;
376
377 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
378
379 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
380
381 struct Specifier;
382
383 extern struct Specifier * MkSpecifierName(const char *  name);
384
385 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
386
387 extern void FreeSpecifier(struct Specifier * spec);
388
389 extern struct Specifier * MkSpecifier(int specifier);
390
391 extern struct Specifier * CopySpecifier(struct Specifier * spec);
392
393 extern struct Specifier * MkSpecifierExtended(struct ExtDecl * extDecl);
394
395 struct Identifier;
396
397 extern struct Identifier * GetDeclId(struct Declarator * decl);
398
399 struct Identifier
400 {
401 struct Identifier * prev;
402 struct Identifier * next;
403 struct Location loc;
404 struct Symbol * classSym;
405 struct Specifier * _class;
406 char *  string;
407 struct Identifier * badID;
408 } __attribute__ ((gcc_struct));
409
410 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
411
412 extern struct Identifier * MkIdentifier(const char *  string);
413
414 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
415
416 struct Expression;
417
418 struct Specifier
419 {
420 struct Specifier * prev;
421 struct Specifier * next;
422 struct Location loc;
423 int type;
424 union
425 {
426 int specifier;
427 struct
428 {
429 struct ExtDecl * extDecl;
430 char *  name;
431 struct Symbol * symbol;
432 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
433 } __attribute__ ((gcc_struct)) __anon1;
434 struct
435 {
436 struct Identifier * id;
437 struct __ecereNameSpace__ecere__sys__OldList *  list;
438 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
439 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
440 unsigned int addNameSpace;
441 struct Context * ctx;
442 struct ExtDecl * extDeclStruct;
443 } __attribute__ ((gcc_struct)) __anon2;
444 struct Expression * expression;
445 struct Specifier * _class;
446 struct TemplateParameter * templateParameter;
447 } __attribute__ ((gcc_struct)) __anon1;
448 } __attribute__ ((gcc_struct));
449
450 struct Declarator
451 {
452 struct Declarator * prev;
453 struct Declarator * next;
454 struct Location loc;
455 int type;
456 struct Symbol * symbol;
457 struct Declarator * declarator;
458 union
459 {
460 struct Identifier * identifier;
461 struct
462 {
463 struct Expression * exp;
464 struct Expression * posExp;
465 struct Attrib * attrib;
466 } __attribute__ ((gcc_struct)) structDecl;
467 struct
468 {
469 struct Expression * exp;
470 struct Specifier * enumClass;
471 } __attribute__ ((gcc_struct)) array;
472 struct
473 {
474 struct __ecereNameSpace__ecere__sys__OldList * parameters;
475 } __attribute__ ((gcc_struct)) function;
476 struct
477 {
478 struct Pointer * pointer;
479 } __attribute__ ((gcc_struct)) pointer;
480 struct
481 {
482 struct ExtDecl * extended;
483 } __attribute__ ((gcc_struct)) extended;
484 } __attribute__ ((gcc_struct)) __anon1;
485 } __attribute__ ((gcc_struct));
486
487 extern struct Expression * QMkExpId(const char *  id);
488
489 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
490
491 extern struct Expression * CopyExpression(struct Expression * exp);
492
493 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
494
495 extern struct Expression * MkExpIdentifier(struct Identifier * id);
496
497 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
498
499 extern struct Attribute * MkAttribute(char * attr, struct Expression * exp);
500
501 struct Type;
502
503 struct __ecereNameSpace__ecere__com__Property
504 {
505 struct __ecereNameSpace__ecere__com__Property * prev;
506 struct __ecereNameSpace__ecere__com__Property * next;
507 const char *  name;
508 unsigned int isProperty;
509 int memberAccess;
510 int id;
511 struct __ecereNameSpace__ecere__com__Class * _class;
512 const char *  dataTypeString;
513 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
514 struct Type * dataType;
515 void (*  Set)(void * , int);
516 int (*  Get)(void * );
517 unsigned int (*  IsSet)(void * );
518 void *  data;
519 void *  symbol;
520 int vid;
521 unsigned int conversion;
522 unsigned int watcherOffset;
523 const char *  category;
524 unsigned int compiled;
525 unsigned int selfWatchable;
526 unsigned int isWatchable;
527 } __attribute__ ((gcc_struct));
528
529 extern struct Type * MkClassType(const char *  name);
530
531 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
532
533 extern void FreeType(struct Type * type);
534
535 struct ClassFunction;
536
537 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
538
539 struct Initializer;
540
541 struct Initializer
542 {
543 struct Initializer * prev;
544 struct Initializer * next;
545 struct Location loc;
546 int type;
547 union
548 {
549 struct Expression * exp;
550 struct __ecereNameSpace__ecere__sys__OldList *  list;
551 } __attribute__ ((gcc_struct)) __anon1;
552 unsigned int isConstant;
553 struct Identifier * id;
554 } __attribute__ ((gcc_struct));
555
556 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
557
558 extern void FreeInitializer(struct Initializer * initializer);
559
560 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
561
562 struct __ecereNameSpace__ecere__com__Method;
563
564 struct __ecereNameSpace__ecere__com__Method
565 {
566 const char *  name;
567 struct __ecereNameSpace__ecere__com__Method * parent;
568 struct __ecereNameSpace__ecere__com__Method * left;
569 struct __ecereNameSpace__ecere__com__Method * right;
570 int depth;
571 int (*  function)();
572 int vid;
573 int type;
574 struct __ecereNameSpace__ecere__com__Class * _class;
575 void *  symbol;
576 const char *  dataTypeString;
577 struct Type * dataType;
578 int memberAccess;
579 } __attribute__ ((gcc_struct));
580
581 struct Symbol
582 {
583 char *  string;
584 struct Symbol * parent;
585 struct Symbol * left;
586 struct Symbol * right;
587 int depth;
588 struct Type * type;
589 union
590 {
591 struct __ecereNameSpace__ecere__com__Method * method;
592 struct __ecereNameSpace__ecere__com__Property * _property;
593 struct __ecereNameSpace__ecere__com__Class * registered;
594 } __attribute__ ((gcc_struct)) __anon1;
595 unsigned int notYetDeclared;
596 union
597 {
598 struct
599 {
600 struct External * pointerExternal;
601 struct External * structExternal;
602 } __attribute__ ((gcc_struct)) __anon1;
603 struct
604 {
605 struct External * externalGet;
606 struct External * externalSet;
607 struct External * externalPtr;
608 struct External * externalIsSet;
609 } __attribute__ ((gcc_struct)) __anon2;
610 struct
611 {
612 struct External * methodExternal;
613 struct External * methodCodeExternal;
614 } __attribute__ ((gcc_struct)) __anon3;
615 } __attribute__ ((gcc_struct)) __anon2;
616 unsigned int imported;
617 unsigned int declaredStructSym;
618 struct __ecereNameSpace__ecere__com__Class * _class;
619 unsigned int declaredStruct;
620 unsigned int needConstructor;
621 unsigned int needDestructor;
622 char *  constructorName;
623 char *  structName;
624 char *  className;
625 char *  destructorName;
626 struct ModuleImport * module;
627 struct ClassImport * _import;
628 struct Location nameLoc;
629 unsigned int isParam;
630 unsigned int isRemote;
631 unsigned int isStruct;
632 unsigned int fireWatchersDone;
633 int declaring;
634 unsigned int classData;
635 unsigned int isStatic;
636 char *  shortName;
637 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
638 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
639 struct Context * ctx;
640 int isIterator;
641 struct Expression * propCategory;
642 } __attribute__ ((gcc_struct));
643
644 struct Type
645 {
646 struct Type * prev;
647 struct Type * next;
648 int refCount;
649 union
650 {
651 struct Symbol * _class;
652 struct
653 {
654 struct __ecereNameSpace__ecere__sys__OldList members;
655 char *  enumName;
656 } __attribute__ ((gcc_struct)) __anon1;
657 struct
658 {
659 struct Type * returnType;
660 struct __ecereNameSpace__ecere__sys__OldList params;
661 struct Symbol * thisClass;
662 unsigned int staticMethod;
663 struct TemplateParameter * thisClassTemplate;
664 } __attribute__ ((gcc_struct)) __anon2;
665 struct
666 {
667 struct __ecereNameSpace__ecere__com__Method * method;
668 struct __ecereNameSpace__ecere__com__Class * methodClass;
669 struct __ecereNameSpace__ecere__com__Class * usedClass;
670 } __attribute__ ((gcc_struct)) __anon3;
671 struct
672 {
673 struct Type * arrayType;
674 int arraySize;
675 struct Expression * arraySizeExp;
676 unsigned int freeExp;
677 struct Symbol * enumClass;
678 } __attribute__ ((gcc_struct)) __anon4;
679 struct Type * type;
680 struct TemplateParameter * templateParameter;
681 } __attribute__ ((gcc_struct)) __anon1;
682 int kind;
683 unsigned int size;
684 char *  name;
685 char *  typeName;
686 struct __ecereNameSpace__ecere__com__Class * thisClassFrom;
687 int classObjectType;
688 int alignment;
689 unsigned int offset;
690 int bitFieldCount;
691 int count;
692 unsigned int isSigned : 1;
693 unsigned int constant : 1;
694 unsigned int truth : 1;
695 unsigned int byReference : 1;
696 unsigned int extraParam : 1;
697 unsigned int directClassAccess : 1;
698 unsigned int computing : 1;
699 unsigned int keepCast : 1;
700 unsigned int passAsTemplate : 1;
701 unsigned int dllExport : 1;
702 unsigned int attrStdcall : 1;
703 unsigned int declaredWithStruct : 1;
704 unsigned int typedByReference : 1;
705 unsigned int casted : 1;
706 unsigned int pointerAlignment : 1;
707 } __attribute__ ((gcc_struct));
708
709 extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_AddMethod(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, const char *  type, void *  function, int declMode);
710
711 extern void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
712
713 unsigned int __ecereProp_Type_Get_isPointerType(struct Type * this);
714
715 struct Statement;
716
717 struct ClassFunction
718 {
719 struct ClassFunction * prev;
720 struct ClassFunction * next;
721 struct Location loc;
722 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
723 struct Declarator * declarator;
724 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
725 struct Statement * body;
726 struct __ecereNameSpace__ecere__com__Class * _class;
727 struct __ecereNameSpace__ecere__sys__OldList attached;
728 int declMode;
729 struct Type * type;
730 struct Symbol * propSet;
731 unsigned int isVirtual;
732 unsigned int isConstructor;
733 unsigned int isDestructor;
734 unsigned int dontMangle;
735 int id;
736 int idCode;
737 } __attribute__ ((gcc_struct));
738
739 struct Statement
740 {
741 struct Statement * prev;
742 struct Statement * next;
743 struct Location loc;
744 int type;
745 union
746 {
747 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
748 struct
749 {
750 struct Identifier * id;
751 struct Statement * stmt;
752 } __attribute__ ((gcc_struct)) labeled;
753 struct
754 {
755 struct Expression * exp;
756 struct Statement * stmt;
757 } __attribute__ ((gcc_struct)) caseStmt;
758 struct
759 {
760 struct __ecereNameSpace__ecere__sys__OldList * declarations;
761 struct __ecereNameSpace__ecere__sys__OldList * statements;
762 struct Context * context;
763 unsigned int isSwitch;
764 } __attribute__ ((gcc_struct)) compound;
765 struct
766 {
767 struct __ecereNameSpace__ecere__sys__OldList * exp;
768 struct Statement * stmt;
769 struct Statement * elseStmt;
770 } __attribute__ ((gcc_struct)) ifStmt;
771 struct
772 {
773 struct __ecereNameSpace__ecere__sys__OldList * exp;
774 struct Statement * stmt;
775 } __attribute__ ((gcc_struct)) switchStmt;
776 struct
777 {
778 struct __ecereNameSpace__ecere__sys__OldList * exp;
779 struct Statement * stmt;
780 } __attribute__ ((gcc_struct)) whileStmt;
781 struct
782 {
783 struct __ecereNameSpace__ecere__sys__OldList * exp;
784 struct Statement * stmt;
785 } __attribute__ ((gcc_struct)) doWhile;
786 struct
787 {
788 struct Statement * init;
789 struct Statement * check;
790 struct __ecereNameSpace__ecere__sys__OldList * increment;
791 struct Statement * stmt;
792 } __attribute__ ((gcc_struct)) forStmt;
793 struct
794 {
795 struct Identifier * id;
796 } __attribute__ ((gcc_struct)) gotoStmt;
797 struct
798 {
799 struct Specifier * spec;
800 char * statements;
801 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
802 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
803 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
804 } __attribute__ ((gcc_struct)) asmStmt;
805 struct
806 {
807 struct Expression * watcher;
808 struct Expression * object;
809 struct __ecereNameSpace__ecere__sys__OldList * watches;
810 } __attribute__ ((gcc_struct)) _watch;
811 struct
812 {
813 struct Identifier * id;
814 struct __ecereNameSpace__ecere__sys__OldList * exp;
815 struct __ecereNameSpace__ecere__sys__OldList * filter;
816 struct Statement * stmt;
817 } __attribute__ ((gcc_struct)) forEachStmt;
818 struct Declaration * decl;
819 } __attribute__ ((gcc_struct)) __anon1;
820 } __attribute__ ((gcc_struct));
821
822 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
823
824 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
825
826 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
827
828 extern struct Statement * MkReturnStmt(struct __ecereNameSpace__ecere__sys__OldList * exp);
829
830 struct __ecereNameSpace__ecere__sys__BinaryTree;
831
832 struct __ecereNameSpace__ecere__sys__BinaryTree
833 {
834 struct __ecereNameSpace__ecere__sys__BTNode * root;
835 int count;
836 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
837 void (*  FreeKey)(void *  key);
838 } __attribute__ ((gcc_struct));
839
840 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, const char *  key);
841
842 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
843
844 struct __ecereNameSpace__ecere__com__DataMember;
845
846 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
847 {
848 union
849 {
850 struct
851 {
852 const char *  dataTypeString;
853 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
854 } __attribute__ ((gcc_struct)) __anon1;
855 struct __ecereNameSpace__ecere__com__DataValue expression;
856 struct
857 {
858 const char *  memberString;
859 union
860 {
861 struct __ecereNameSpace__ecere__com__DataMember * member;
862 struct __ecereNameSpace__ecere__com__Property * prop;
863 struct __ecereNameSpace__ecere__com__Method * method;
864 } __attribute__ ((gcc_struct)) __anon1;
865 } __attribute__ ((gcc_struct)) __anon2;
866 } __attribute__ ((gcc_struct)) __anon1;
867 } __attribute__ ((gcc_struct));
868
869 struct __ecereNameSpace__ecere__com__DataMember
870 {
871 struct __ecereNameSpace__ecere__com__DataMember * prev;
872 struct __ecereNameSpace__ecere__com__DataMember * next;
873 const char *  name;
874 unsigned int isProperty;
875 int memberAccess;
876 int id;
877 struct __ecereNameSpace__ecere__com__Class * _class;
878 const char *  dataTypeString;
879 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
880 struct Type * dataType;
881 int type;
882 int offset;
883 int memberID;
884 struct __ecereNameSpace__ecere__sys__OldList members;
885 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
886 int memberOffset;
887 short structAlignment;
888 short pointerAlignment;
889 } __attribute__ ((gcc_struct));
890
891 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_AddDataMember(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, const char *  type, unsigned int size, unsigned int alignment, int declMode);
892
893 struct __ecereNameSpace__ecere__com__Module;
894
895 extern unsigned int ModuleAccess(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor);
896
897 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
898
899 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_FindDataMember(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, struct __ecereNameSpace__ecere__com__Instance * module, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
900
901 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, const char *  name);
902
903 extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_FindProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
904
905 extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_FindMethod(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
906
907 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_RegisterFunction(const char *  name, const char *  type, void *  func, struct __ecereNameSpace__ecere__com__Instance * module, int declMode);
908
909 struct TypeName;
910
911 struct TypeName
912 {
913 struct TypeName * prev;
914 struct TypeName * next;
915 struct Location loc;
916 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
917 struct Declarator * declarator;
918 int classObjectType;
919 struct Expression * bitCount;
920 } __attribute__ ((gcc_struct));
921
922 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
923
924 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
925
926 struct ClassDef;
927
928 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
929
930 extern struct ClassDef * MkClassDefFunction(struct ClassFunction * function);
931
932 struct ClassDefinition;
933
934 struct Context
935 {
936 struct Context * parent;
937 struct __ecereNameSpace__ecere__sys__BinaryTree types;
938 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
939 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
940 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
941 int nextID;
942 int simpleID;
943 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
944 struct ClassDefinition * classDef;
945 unsigned int templateTypesOnly;
946 unsigned int hasNameSpace;
947 } __attribute__ ((gcc_struct));
948
949 struct ClassDefinition
950 {
951 struct ClassDefinition * prev;
952 struct ClassDefinition * next;
953 struct Location loc;
954 struct Specifier * _class;
955 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
956 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
957 struct Symbol * symbol;
958 struct Location blockStart;
959 struct Location nameLoc;
960 int declMode;
961 unsigned int deleteWatchable;
962 } __attribute__ ((gcc_struct));
963
964 struct Instantiation;
965
966 struct Expression
967 {
968 struct Expression * prev;
969 struct Expression * next;
970 struct Location loc;
971 int type;
972 union
973 {
974 struct
975 {
976 char *  constant;
977 struct Identifier * identifier;
978 } __attribute__ ((gcc_struct)) __anon1;
979 struct Statement * compound;
980 struct Instantiation * instance;
981 struct
982 {
983 char *  string;
984 unsigned int intlString;
985 unsigned int wideString;
986 } __attribute__ ((gcc_struct)) __anon2;
987 struct __ecereNameSpace__ecere__sys__OldList *  list;
988 struct
989 {
990 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
991 struct Declarator * decl;
992 } __attribute__ ((gcc_struct)) _classExp;
993 struct
994 {
995 struct Identifier * id;
996 } __attribute__ ((gcc_struct)) classData;
997 struct
998 {
999 struct Expression * exp;
1000 struct __ecereNameSpace__ecere__sys__OldList * arguments;
1001 struct Location argLoc;
1002 } __attribute__ ((gcc_struct)) call;
1003 struct
1004 {
1005 struct Expression * exp;
1006 struct __ecereNameSpace__ecere__sys__OldList * index;
1007 } __attribute__ ((gcc_struct)) index;
1008 struct
1009 {
1010 struct Expression * exp;
1011 struct Identifier * member;
1012 int memberType;
1013 unsigned int thisPtr;
1014 } __attribute__ ((gcc_struct)) member;
1015 struct
1016 {
1017 int op;
1018 struct Expression * exp1;
1019 struct Expression * exp2;
1020 } __attribute__ ((gcc_struct)) op;
1021 struct TypeName * typeName;
1022 struct Specifier * _class;
1023 struct
1024 {
1025 struct TypeName * typeName;
1026 struct Expression * exp;
1027 } __attribute__ ((gcc_struct)) cast;
1028 struct
1029 {
1030 struct Expression * cond;
1031 struct __ecereNameSpace__ecere__sys__OldList * exp;
1032 struct Expression * elseExp;
1033 } __attribute__ ((gcc_struct)) cond;
1034 struct
1035 {
1036 struct TypeName * typeName;
1037 struct Expression * size;
1038 } __attribute__ ((gcc_struct)) _new;
1039 struct
1040 {
1041 struct TypeName * typeName;
1042 struct Expression * size;
1043 struct Expression * exp;
1044 } __attribute__ ((gcc_struct)) _renew;
1045 struct
1046 {
1047 char * table;
1048 struct Identifier * id;
1049 } __attribute__ ((gcc_struct)) db;
1050 struct
1051 {
1052 struct Expression * ds;
1053 struct Expression * name;
1054 } __attribute__ ((gcc_struct)) dbopen;
1055 struct
1056 {
1057 struct TypeName * typeName;
1058 struct Initializer * initializer;
1059 } __attribute__ ((gcc_struct)) initializer;
1060 struct
1061 {
1062 struct Expression * exp;
1063 struct TypeName * typeName;
1064 } __attribute__ ((gcc_struct)) vaArg;
1065 } __attribute__ ((gcc_struct)) __anon1;
1066 unsigned int debugValue;
1067 struct __ecereNameSpace__ecere__com__DataValue val;
1068 uint64 address;
1069 unsigned int hasAddress;
1070 struct Type * expType;
1071 struct Type * destType;
1072 unsigned int usage;
1073 int tempCount;
1074 unsigned int byReference;
1075 unsigned int isConstant;
1076 unsigned int addedThis;
1077 unsigned int needCast;
1078 unsigned int thisPtr;
1079 unsigned int opDestType;
1080 unsigned int needTemplateCast;
1081 } __attribute__ ((gcc_struct));
1082
1083 struct Instantiation
1084 {
1085 struct Instantiation * prev;
1086 struct Instantiation * next;
1087 struct Location loc;
1088 struct Specifier * _class;
1089 struct Expression * exp;
1090 struct __ecereNameSpace__ecere__sys__OldList *  members;
1091 struct Symbol * symbol;
1092 unsigned int fullSet;
1093 unsigned int isConstant;
1094 unsigned char *  data;
1095 struct Location nameLoc;
1096 struct Location insideLoc;
1097 unsigned int built;
1098 } __attribute__ ((gcc_struct));
1099
1100 struct Declaration
1101 {
1102 struct Declaration * prev;
1103 struct Declaration * next;
1104 struct Location loc;
1105 int type;
1106 union
1107 {
1108 struct
1109 {
1110 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1111 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
1112 } __attribute__ ((gcc_struct)) __anon1;
1113 struct Instantiation * inst;
1114 struct
1115 {
1116 struct Identifier * id;
1117 struct Expression * exp;
1118 } __attribute__ ((gcc_struct)) __anon2;
1119 } __attribute__ ((gcc_struct)) __anon1;
1120 struct Specifier * extStorage;
1121 struct Symbol * symbol;
1122 int declMode;
1123 } __attribute__ ((gcc_struct));
1124
1125 extern struct Expression * MkExpInstance(struct Instantiation * inst);
1126
1127 struct MembersInit;
1128
1129 struct MembersInit
1130 {
1131 struct MembersInit * prev;
1132 struct MembersInit * next;
1133 struct Location loc;
1134 int type;
1135 union
1136 {
1137 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1138 struct ClassFunction * function;
1139 } __attribute__ ((gcc_struct)) __anon1;
1140 } __attribute__ ((gcc_struct));
1141
1142 struct MemberInit;
1143
1144 struct MemberInit
1145 {
1146 struct MemberInit * prev;
1147 struct MemberInit * next;
1148 struct Location loc;
1149 struct Location realLoc;
1150 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1151 struct Initializer * initializer;
1152 unsigned int used;
1153 unsigned int variable;
1154 unsigned int takeOutExp;
1155 } __attribute__ ((gcc_struct));
1156
1157 static void CheckPublicExpression(struct Expression *  exp, int access);
1158
1159 static void CheckPublicInitializer(struct Initializer * init, int access)
1160 {
1161 switch(init->type)
1162 {
1163 case 0:
1164 CheckPublicExpression(init->__anon1.exp, access);
1165 break;
1166 case 1:
1167 {
1168 struct Initializer * i;
1169
1170 for(i = (*init->__anon1.list).first; i; i = i->next)
1171 CheckPublicInitializer(i, access);
1172 break;
1173 }
1174 }
1175 }
1176
1177 static void CheckPublicClass(struct Symbol *  classSym, int access, const char *  word);
1178
1179 static void CheckPublicTypeName(struct TypeName * type, int access)
1180 {
1181 if(type->qualifiers)
1182 {
1183 struct Specifier * spec;
1184
1185 for(spec = (*type->qualifiers).first; spec; spec = spec->next)
1186 {
1187 if(spec->type == 1)
1188 {
1189 struct Symbol * classSym = spec->__anon1.__anon1.symbol;
1190
1191 CheckPublicClass(classSym, access, "define");
1192 }
1193 }
1194 }
1195 }
1196
1197 static void CheckPublicDataType(struct Type * type, int access, const char * word)
1198 {
1199 if(type)
1200 {
1201 switch(type->kind)
1202 {
1203 case 8:
1204 {
1205 CheckPublicClass(type->__anon1._class, access, word);
1206 break;
1207 }
1208 case 9:
1209 case 10:
1210 {
1211 break;
1212 }
1213 case 11:
1214 {
1215 struct Type * param;
1216
1217 CheckPublicDataType(type->__anon1.__anon2.returnType, access, word);
1218 for(param = type->__anon1.__anon2.params.first; param; param = param->next)
1219 CheckPublicDataType(param, access, word);
1220 CheckPublicClass(type->__anon1.__anon2.thisClass, access, word);
1221 break;
1222 }
1223 case 12:
1224 CheckPublicDataType(type->__anon1.__anon4.arrayType, access, word);
1225 if(type->__anon1.__anon4.enumClass)
1226 CheckPublicClass(type->__anon1.__anon4.enumClass, access, word);
1227 break;
1228 case 13:
1229 {
1230 CheckPublicDataType(type->__anon1.type, access, word);
1231 break;
1232 }
1233 case 16:
1234 {
1235 break;
1236 }
1237 case 19:
1238 {
1239 CheckPublicClass(type->__anon1._class, access, word);
1240 break;
1241 }
1242 }
1243 }
1244 }
1245
1246 static void CheckPublicExpression(struct Expression * exp, int access)
1247 {
1248 if(exp)
1249 {
1250 switch(exp->type)
1251 {
1252 case 0:
1253 break;
1254 case 2:
1255 break;
1256 case 3:
1257 break;
1258 case 4:
1259 if(exp->__anon1.op.exp1)
1260 CheckPublicExpression(exp->__anon1.op.exp1, access);
1261 if(exp->__anon1.op.exp2)
1262 CheckPublicExpression(exp->__anon1.op.exp2, access);
1263 break;
1264 case 5:
1265 {
1266 struct Expression * e;
1267
1268 for(e = (*exp->__anon1.list).first; e; e = e->next)
1269 CheckPublicExpression(e, access);
1270 break;
1271 }
1272 case 6:
1273 {
1274 struct Expression * e;
1275
1276 CheckPublicExpression(exp->__anon1.index.exp, access);
1277 for(e = (*exp->__anon1.index.index).first; e; e = e->next)
1278 CheckPublicExpression(e, access);
1279 break;
1280 }
1281 case 7:
1282 {
1283 struct Expression * e;
1284
1285 CheckPublicExpression(exp->__anon1.call.exp, access);
1286 if(exp->__anon1.call.arguments)
1287 {
1288 for(e = (*exp->__anon1.call.arguments).first; e; e = e->next)
1289 CheckPublicExpression(e, access);
1290 }
1291 break;
1292 }
1293 case 8:
1294 {
1295 CheckPublicExpression(exp->__anon1.member.exp, access);
1296 break;
1297 }
1298 case 9:
1299 {
1300 CheckPublicExpression(exp->__anon1.member.exp, access);
1301 break;
1302 }
1303 case 10:
1304 CheckPublicTypeName(exp->__anon1.typeName, access);
1305 break;
1306 case 11:
1307 {
1308 CheckPublicTypeName(exp->__anon1.cast.typeName, access);
1309 if(exp->__anon1.cast.exp)
1310 CheckPublicExpression(exp->__anon1.cast.exp, access);
1311 break;
1312 }
1313 case 12:
1314 {
1315 struct Expression * e;
1316
1317 CheckPublicExpression(exp->__anon1.cond.cond, access);
1318 for(e = (*exp->__anon1.cond.exp).first; e; e = e->next)
1319 CheckPublicExpression(e, access);
1320 CheckPublicExpression(exp->__anon1.cond.elseExp, access);
1321 break;
1322 }
1323 case 13:
1324 case 26:
1325 CheckPublicExpression(exp->__anon1._new.size, access);
1326 break;
1327 case 14:
1328 case 27:
1329 CheckPublicExpression(exp->__anon1._renew.size, access);
1330 CheckPublicExpression(exp->__anon1._renew.exp, access);
1331 break;
1332 case 1:
1333 {
1334 struct MembersInit * members;
1335
1336 CheckPublicClass(exp->__anon1.instance->_class->__anon1.__anon1.symbol, access, "define");
1337 for(members = (*exp->__anon1.instance->members).first; members; members = members->next)
1338 {
1339 if(members->type == 0)
1340 {
1341 struct MemberInit * member;
1342
1343 for(member = (*members->__anon1.dataMembers).first; member; member = member->next)
1344 {
1345 CheckPublicInitializer(member->initializer, access);
1346 }
1347 }
1348 }
1349 break;
1350 }
1351 }
1352 }
1353 }
1354
1355 struct PropertyDef;
1356
1357 struct ClassDef
1358 {
1359 struct ClassDef * prev;
1360 struct ClassDef * next;
1361 struct Location loc;
1362 int type;
1363 union
1364 {
1365 struct Declaration * decl;
1366 struct ClassFunction * function;
1367 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1368 struct PropertyDef * propertyDef;
1369 struct PropertyWatch * propertyWatch;
1370 char *  designer;
1371 struct Identifier * defaultProperty;
1372 struct
1373 {
1374 struct Identifier * id;
1375 struct Initializer * initializer;
1376 } __attribute__ ((gcc_struct)) __anon1;
1377 } __attribute__ ((gcc_struct)) __anon1;
1378 int memberAccess;
1379 void *  object;
1380 } __attribute__ ((gcc_struct));
1381
1382 struct PropertyDef
1383 {
1384 struct PropertyDef * prev;
1385 struct PropertyDef * next;
1386 struct Location loc;
1387 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1388 struct Declarator * declarator;
1389 struct Identifier * id;
1390 struct Statement * getStmt;
1391 struct Statement * setStmt;
1392 struct Statement * issetStmt;
1393 struct Symbol * symbol;
1394 struct Expression * category;
1395 struct
1396 {
1397 unsigned int conversion : 1;
1398 unsigned int isWatchable : 1;
1399 unsigned int isDBProp : 1;
1400 } __attribute__ ((gcc_struct)) __anon1;
1401 } __attribute__ ((gcc_struct));
1402
1403 static void CheckMembersDefinitions(struct __ecereNameSpace__ecere__com__Class * regClass, struct __ecereNameSpace__ecere__com__DataMember * member, struct __ecereNameSpace__ecere__sys__OldList * definitions, int access)
1404 {
1405 if(definitions != (((void *)0)))
1406 {
1407 struct ClassDef * def;
1408
1409 for(def = definitions->first; def; def = def->next)
1410 {
1411 if(def->type == 2)
1412 {
1413 struct Declaration * decl = def->__anon1.decl;
1414 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
1415
1416 yylloc = def->loc;
1417 if(decl->type == 0)
1418 {
1419 struct Declarator * d;
1420
1421 if(decl->__anon1.__anon1.declarators)
1422 {
1423 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
1424 {
1425 struct Identifier * declId = GetDeclId(d);
1426
1427 if(declId)
1428 {
1429 if(member)
1430 {
1431 struct __ecereNameSpace__ecere__com__BTNamedLink * link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&member->membersAlpha, declId->string);
1432
1433 dataMember = link ? link->data : (((void *)0));
1434 }
1435 else
1436 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(regClass, declId->string, privateModule, (((void *)0)), (((void *)0)));
1437 if(dataMember)
1438 CheckPublicDataType(dataMember->dataType, (def->memberAccess == 2) ? 2 : access, __ecereNameSpace__ecere__GetTranslatedString("ec", "class data member", (((void *)0))));
1439 }
1440 }
1441 }
1442 else if(decl->__anon1.__anon1.specifiers)
1443 {
1444 struct Specifier * spec;
1445
1446 for(spec = (*decl->__anon1.__anon1.specifiers).first; spec; spec = spec->next)
1447 {
1448 if(spec->type == 3 || spec->type == 4)
1449 {
1450 if(spec->__anon1.__anon2.definitions && !spec->__anon1.__anon2.id)
1451 {
1452 CheckMembersDefinitions(regClass, member, spec->__anon1.__anon2.definitions, (def->memberAccess == 2) ? 2 : access);
1453 }
1454 else if(spec->__anon1.__anon2.definitions && spec->__anon1.__anon2.id)
1455 {
1456 if(member)
1457 {
1458 struct __ecereNameSpace__ecere__com__BTNamedLink * link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&member->membersAlpha, spec->__anon1.__anon2.id->string);
1459
1460 dataMember = link ? link->data : (((void *)0));
1461 }
1462 else
1463 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(regClass, spec->__anon1.__anon2.id->string, privateModule, (((void *)0)), (((void *)0)));
1464 if(dataMember)
1465 CheckPublicDataType(dataMember->dataType, (def->memberAccess == 2) ? 2 : access, __ecereNameSpace__ecere__GetTranslatedString("ec", "class data member", (((void *)0))));
1466 }
1467 }
1468 }
1469 }
1470 }
1471 else if(decl->type == 2)
1472 {
1473 CheckPublicClass(decl->__anon1.inst->_class->__anon1.__anon1.symbol, (def->memberAccess == 2) ? 2 : access, __ecereNameSpace__ecere__GetTranslatedString("ec", "class member instance", (((void *)0))));
1474 }
1475 }
1476 }
1477 }
1478 }
1479
1480 struct FunctionDefinition;
1481
1482 typedef union YYSTYPE
1483 {
1484 int specifierType;
1485 int i;
1486 int declMode;
1487 struct Identifier * id;
1488 struct Expression * exp;
1489 struct Specifier * specifier;
1490 struct __ecereNameSpace__ecere__sys__OldList * list;
1491 struct Enumerator * enumerator;
1492 struct Declarator * declarator;
1493 struct Pointer * pointer;
1494 struct Initializer * initializer;
1495 struct InitDeclarator * initDeclarator;
1496 struct TypeName * typeName;
1497 struct Declaration * declaration;
1498 struct Statement * stmt;
1499 struct FunctionDefinition * function;
1500 struct External * external;
1501 struct Context * context;
1502 struct AsmField * asmField;
1503 struct Attrib * attrib;
1504 struct ExtDecl * extDecl;
1505 struct Attribute * attribute;
1506 struct Instantiation * instance;
1507 struct MembersInit * membersInit;
1508 struct MemberInit * memberInit;
1509 struct ClassFunction * classFunction;
1510 struct ClassDefinition * _class;
1511 struct ClassDef * classDef;
1512 struct PropertyDef * prop;
1513 char * string;
1514 struct Symbol * symbol;
1515 struct PropertyWatch * propertyWatch;
1516 struct TemplateParameter * templateParameter;
1517 struct TemplateArgument * templateArgument;
1518 struct TemplateDatatype * templateDatatype;
1519 struct DBTableEntry * dbtableEntry;
1520 struct DBIndexItem * dbindexItem;
1521 struct DBTableDef * dbtableDef;
1522 } __attribute__ ((gcc_struct)) YYSTYPE;
1523
1524 extern YYSTYPE yylval;
1525
1526 struct External
1527 {
1528 struct External * prev;
1529 struct External * next;
1530 struct Location loc;
1531 int type;
1532 struct Symbol * symbol;
1533 union
1534 {
1535 struct FunctionDefinition * function;
1536 struct ClassDefinition * _class;
1537 struct Declaration * declaration;
1538 char *  importString;
1539 struct Identifier * id;
1540 struct DBTableDef * table;
1541 } __attribute__ ((gcc_struct)) __anon1;
1542 int importType;
1543 struct External * fwdDecl;
1544 struct __ecereNameSpace__ecere__com__Instance * outgoing;
1545 struct __ecereNameSpace__ecere__com__Instance * incoming;
1546 int nonBreakableIncoming;
1547 } __attribute__ ((gcc_struct));
1548
1549 struct FunctionDefinition
1550 {
1551 struct FunctionDefinition * prev;
1552 struct FunctionDefinition * next;
1553 struct Location loc;
1554 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1555 struct Declarator * declarator;
1556 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1557 struct Statement * body;
1558 struct __ecereNameSpace__ecere__com__Class * _class;
1559 struct __ecereNameSpace__ecere__sys__OldList attached;
1560 int declMode;
1561 struct Type * type;
1562 struct Symbol * propSet;
1563 int tempCount;
1564 unsigned int propertyNoThis;
1565 } __attribute__ ((gcc_struct));
1566
1567 void __ecereMethod_External_CreateUniqueEdge(struct External * this, struct External * from, unsigned int soft);
1568
1569 struct __ecereNameSpace__ecere__com__NameSpace;
1570
1571 struct __ecereNameSpace__ecere__com__NameSpace
1572 {
1573 const char *  name;
1574 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
1575 struct __ecereNameSpace__ecere__com__NameSpace *  left;
1576 struct __ecereNameSpace__ecere__com__NameSpace *  right;
1577 int depth;
1578 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
1579 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
1580 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
1581 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
1582 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
1583 } __attribute__ ((gcc_struct));
1584
1585 struct __ecereNameSpace__ecere__com__Class
1586 {
1587 struct __ecereNameSpace__ecere__com__Class * prev;
1588 struct __ecereNameSpace__ecere__com__Class * next;
1589 const char *  name;
1590 int offset;
1591 int structSize;
1592 void * *  _vTbl;
1593 int vTblSize;
1594 unsigned int (*  Constructor)(void * );
1595 void (*  Destructor)(void * );
1596 int offsetClass;
1597 int sizeClass;
1598 struct __ecereNameSpace__ecere__com__Class * base;
1599 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
1600 struct __ecereNameSpace__ecere__sys__BinaryTree members;
1601 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
1602 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
1603 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
1604 struct __ecereNameSpace__ecere__sys__OldList derivatives;
1605 int memberID;
1606 int startMemberID;
1607 int type;
1608 struct __ecereNameSpace__ecere__com__Instance * module;
1609 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
1610 const char *  dataTypeString;
1611 struct Type * dataType;
1612 int typeSize;
1613 int defaultAlignment;
1614 void (*  Initialize)();
1615 int memberOffset;
1616 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
1617 const char *  designerClass;
1618 unsigned int noExpansion;
1619 const char *  defaultProperty;
1620 unsigned int comRedefinition;
1621 int count;
1622 int isRemote;
1623 unsigned int internalDecl;
1624 void *  data;
1625 unsigned int computeSize;
1626 short structAlignment;
1627 short pointerAlignment;
1628 int destructionWatchOffset;
1629 unsigned int fixed;
1630 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
1631 int inheritanceAccess;
1632 const char *  fullName;
1633 void *  symbol;
1634 struct __ecereNameSpace__ecere__sys__OldList conversions;
1635 struct __ecereNameSpace__ecere__sys__OldList templateParams;
1636 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
1637 struct __ecereNameSpace__ecere__com__Class * templateClass;
1638 struct __ecereNameSpace__ecere__sys__OldList templatized;
1639 int numParams;
1640 unsigned int isInstanceClass;
1641 unsigned int byValueSystemClass;
1642 } __attribute__ ((gcc_struct));
1643
1644 struct __ecereNameSpace__ecere__com__Application
1645 {
1646 int argc;
1647 const char * *  argv;
1648 int exitCode;
1649 unsigned int isGUIApp;
1650 struct __ecereNameSpace__ecere__sys__OldList allModules;
1651 char *  parsedCommand;
1652 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
1653 } __attribute__ ((gcc_struct));
1654
1655 static unsigned int NameSpaceContained(struct __ecereNameSpace__ecere__com__NameSpace * ns, struct __ecereNameSpace__ecere__com__NameSpace * parent)
1656 {
1657 if(ns == parent)
1658 return 1;
1659 else if((*ns).parent)
1660 return NameSpaceContained((*ns).parent, parent);
1661 else
1662 return 0;
1663 }
1664
1665 static void AddSimpleBaseMembers(struct External * external, struct __ecereNameSpace__ecere__sys__OldList * list, struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * topClass)
1666 {
1667 if(_class->type != 1000)
1668 AddMembers(external, list, _class, 0, (((void *)0)), topClass, (((void *)0)));
1669 }
1670
1671 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
1672
1673 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
1674
1675 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
1676
1677 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
1678
1679 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__LinkList;
1680
1681 struct __ecereNameSpace__ecere__com__Module
1682 {
1683 struct __ecereNameSpace__ecere__com__Instance * application;
1684 struct __ecereNameSpace__ecere__sys__OldList classes;
1685 struct __ecereNameSpace__ecere__sys__OldList defines;
1686 struct __ecereNameSpace__ecere__sys__OldList functions;
1687 struct __ecereNameSpace__ecere__sys__OldList modules;
1688 struct __ecereNameSpace__ecere__com__Instance * prev;
1689 struct __ecereNameSpace__ecere__com__Instance * next;
1690 const char *  name;
1691 void *  library;
1692 void *  Unload;
1693 int importType;
1694 int origImportType;
1695 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
1696 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
1697 } __attribute__ ((gcc_struct));
1698
1699 void __ecereUnregisterModule_pass0(struct __ecereNameSpace__ecere__com__Instance * module)
1700 {
1701
1702 }
1703
1704 static void CheckPublicClass(struct Symbol * classSym, int access, const char * word)
1705 {
1706 struct __ecereNameSpace__ecere__com__Class * regClass = classSym ? classSym->__anon1.registered : (((void *)0));
1707
1708 if(regClass)
1709 {
1710 if(regClass->templateClass)
1711 regClass = regClass->templateClass;
1712 if(classSym->isStatic && access != 3)
1713 {
1714 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Non-static %s making use of a static class\n", (((void *)0))), word);
1715 }
1716 else if(access == 1)
1717 {
1718 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application + sizeof(struct __ecereNameSpace__ecere__com__Module) + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->systemNameSpace))
1719 {
1720 if(NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->privateNameSpace) || !ModuleAccess(privateModule, regClass->module))
1721 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Public %s making use of a private class\n", (((void *)0))), word);
1722 }
1723 }
1724 }
1725 }
1726
1727 static void ProcessClass(int classType, struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol, struct __ecereNameSpace__ecere__sys__OldList * baseSpecs, struct __ecereNameSpace__ecere__sys__OldList * enumValues, struct Location * loc, struct __ecereNameSpace__ecere__sys__OldList * defs, void * after, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators, struct ExtDecl * extDecl)
1728 {
1729 char structName[1024];
1730 char className[1024];
1731 char constructorName[1024];
1732 char destructorName[1024];
1733 struct __ecereNameSpace__ecere__com__Class * regClass;
1734 struct ClassFunction * destructor = (((void *)0)), * constructor = (((void *)0));
1735 unsigned int isUnion = classType == 6;
1736 struct External * external = (((void *)0));
1737 struct ClassDef * def;
1738 struct __ecereNameSpace__ecere__sys__OldList * list = (((void *)0));
1739 struct __ecereNameSpace__ecere__sys__OldList * classDataList = (((void *)0));
1740
1741 if(inCompiler)
1742 {
1743 list = MkList();
1744 classDataList = MkList();
1745 }
1746 regClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, symbol->string);
1747 if(!regClass)
1748 return ;
1749 classType = regClass->type;
1750 if(inCompiler)
1751 {
1752 yylloc = *loc;
1753 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->privateNameSpace) && regClass->inheritanceAccess == 1)
1754 {
1755 if(!regClass->base->symbol)
1756 regClass->base->symbol = FindClass(regClass->base->fullName);
1757 CheckPublicClass(regClass->base->symbol, 1, __ecereNameSpace__ecere__GetTranslatedString("ec", "class", (((void *)0))));
1758 }
1759 else if(!symbol->isStatic && regClass->base)
1760 {
1761 if(!regClass->base->symbol)
1762 regClass->base->symbol = FindClass(regClass->base->fullName);
1763 CheckPublicClass(regClass->base->symbol, 2, __ecereNameSpace__ecere__GetTranslatedString("ec", "class", (((void *)0))));
1764 }
1765 }
1766 if(definitions != (((void *)0)))
1767 {
1768 for(def = definitions->first; def; def = def->next)
1769 {
1770 if(def->type == 13)
1771 {
1772 struct __ecereNameSpace__ecere__com__DataMember * member;
1773 struct __ecereNameSpace__ecere__com__Property * prop;
1774 struct __ecereNameSpace__ecere__com__Method * method;
1775
1776 if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(regClass, def->__anon1.__anon1.id->string, privateModule)))
1777 {
1778 __ecereNameSpace__ecere__com__eClass_AddProperty(regClass, def->__anon1.__anon1.id->string, (((void *)0)), (((void *)0)), (((void *)0)), def->memberAccess);
1779 }
1780 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(regClass, def->__anon1.__anon1.id->string, privateModule, (((void *)0)), (((void *)0)))))
1781 {
1782 __ecereNameSpace__ecere__com__eClass_AddDataMember(regClass, def->__anon1.__anon1.id->string, (((void *)0)), 0, 0, def->memberAccess);
1783 }
1784 else if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(regClass, def->__anon1.__anon1.id->string, privateModule)))
1785 {
1786 __ecereNameSpace__ecere__com__eClass_AddMethod(regClass, def->__anon1.__anon1.id->string, (((void *)0)), (((void *)0)), def->memberAccess);
1787 }
1788 else
1789 {
1790 yylloc = def->loc;
1791 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Couldn't find member %s to override\n", (((void *)0))), def->__anon1.__anon1.id->string);
1792 }
1793 }
1794 }
1795 }
1796 if(inCompiler)
1797 {
1798 external = MkExternalDeclaration((((void *)0)));
1799 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(defs, after, external);
1800 curExternal = external;
1801 curExternal->symbol = symbol;
1802 }
1803 if((classType == 1 || classType == 5) && inCompiler)
1804 {
1805 AddSimpleBaseMembers(external, list, regClass->base, regClass);
1806 }
1807 if(definitions != (((void *)0)))
1808 {
1809 if(inCompiler)
1810 {
1811 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->privateNameSpace))
1812 CheckMembersDefinitions(regClass, (((void *)0)), definitions, 1);
1813 else if(!symbol->isStatic)
1814 CheckMembersDefinitions(regClass, (((void *)0)), definitions, 2);
1815 }
1816 for(def = definitions->first; def; def = def->next)
1817 {
1818 yylloc = def->loc;
1819 if(def->type == 2)
1820 {
1821 struct Declaration * decl = def->__anon1.decl;
1822
1823 yylloc = decl->loc;
1824 if(decl->type == 0)
1825 {
1826 if(inCompiler && classType != 2)
1827 {
1828 ListAdd(list, MkClassDefDeclaration(decl));
1829 def->__anon1.decl = (((void *)0));
1830 }
1831 }
1832 else if(decl->type == 2)
1833 {
1834 struct Instantiation * inst = decl->__anon1.inst;
1835 struct Expression * exp = inst->exp;
1836 struct Symbol * classSym;
1837
1838 if(exp)
1839 {
1840 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
1841 struct Declarator * d;
1842
1843 ListAdd(specifiers, MkSpecifierName(inst->_class->__anon1.__anon1.name));
1844 d = MkDeclaratorIdentifier(MkIdentifier(exp->__anon1.__anon1.identifier->string));
1845 if(inCompiler)
1846 {
1847 struct __ecereNameSpace__ecere__sys__OldList * declarators = MkList();
1848
1849 ListAdd(declarators, d);
1850 decl = MkStructDeclaration(specifiers, declarators, (((void *)0)));
1851 ListAdd(list, MkClassDefDeclaration(decl));
1852 exp->type = 8;
1853 exp->__anon1.member.member = exp->__anon1.__anon1.identifier;
1854 exp->__anon1.member.exp = QMkExpId("this");
1855 exp->__anon1.member.memberType = 3;
1856 exp->__anon1.member.thisPtr = 1;
1857 }
1858 else
1859 {
1860 FreeDeclarator(d);
1861 FreeList(specifiers, (void *)(FreeSpecifier));
1862 }
1863 }
1864 classSym = inst->_class->__anon1.__anon1.symbol;
1865 if(classSym && classSym->__anon1.registered && (classSym->__anon1.registered->type == 1 || classSym->__anon1.registered->type == 2 || classSym->__anon1.registered->type == 3))
1866 {
1867 if(inst->members && (*inst->members).count)
1868 symbol->needConstructor = 1;
1869 }
1870 else
1871 {
1872 symbol->needConstructor = 1;
1873 symbol->needDestructor = 1;
1874 }
1875 }
1876 }
1877 else if(def->type == 9)
1878 {
1879 struct Declaration * decl = def->__anon1.decl;
1880
1881 if(decl->type == 0)
1882 {
1883 if(inCompiler && classType != 2)
1884 {
1885 ListAdd(classDataList, MkClassDefDeclaration(decl));
1886 def->__anon1.decl = (((void *)0));
1887 }
1888 }
1889 }
1890 else if(def->type == 1)
1891 symbol->needConstructor = 1;
1892 else if(def->type == 4)
1893 symbol->needConstructor = 1;
1894 else if(def->type == 0)
1895 {
1896 struct ClassFunction * func = def->__anon1.function;
1897
1898 if(func->isDestructor)
1899 {
1900 if(destructor)
1901 {
1902 yylloc = *loc;
1903 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "redefinition of destructor for class %s\n", (((void *)0))), symbol->string);
1904 }
1905 else
1906 {
1907 symbol->needDestructor = 1;
1908 destructor = func;
1909 if(!inCompiler && func->body)
1910 {
1911 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
1912
1913 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&func->body->__anon1.compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
1914 }
1915 }
1916 }
1917 if(func->isConstructor)
1918 {
1919 if(constructor)
1920 {
1921 yylloc = *loc;
1922 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "redefinition of constructor for class %s\n", (((void *)0))), symbol->string);
1923 }
1924 else
1925 {
1926 symbol->needConstructor = 1;
1927 constructor = func;
1928 if(!inCompiler && func->body)
1929 {
1930 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
1931
1932 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&func->body->__anon1.compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
1933 }
1934 }
1935 }
1936 }
1937 }
1938 }
1939 if(inCompiler)
1940 {
1941 external->symbol = (((void *)0));
1942 if((*list).count)
1943 {
1944 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * declarators = (initDeclarators != (((void *)0))) ? initDeclarators : MkList();
1945
1946 initDeclarators = (((void *)0));
1947 strcpy(structName, symbol->string);
1948 symbol->structName = __ecereNameSpace__ecere__sys__CopyString(structName);
1949 {
1950 struct Specifier * spec = MkStructOrUnion(3, MkIdentifier(structName), isUnion ? MkListOne(MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkStructOrUnion(4, (((void *)0)), list)), (((void *)0)), (((void *)0))))) : list);
1951
1952 spec->__anon1.__anon2.extDeclStruct = extDecl;
1953 ListAdd(specs, spec);
1954 }
1955 external->symbol = symbol;
1956 if(symbol->__anon2.__anon1.structExternal)
1957 {
1958 {
1959 struct TopoEdge * e;
1960 struct __ecereNameSpace__ecere__com__Instance * __internalLinkList = symbol->__anon2.__anon1.structExternal->incoming;
1961
1962 for(e = ((struct TopoEdge *)(uintptr_t)((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)__internalLinkList + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->first); e; e = (struct TopoEdge *)((struct __ecereNameSpace__ecere__com__IteratorPointer * (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__IteratorPointer * pointer))__extension__ ({
1963 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = __internalLinkList;
1964
1965 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1966 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_GetNext])(__internalLinkList, (struct __ecereNameSpace__ecere__com__IteratorPointer *)e))
1967 __ecereMethod_External_CreateUniqueEdge(external, e->from, e->breakable);
1968 }
1969 {
1970 struct TopoEdge * e;
1971 struct __ecereNameSpace__ecere__com__Instance * __internalLinkList = symbol->__anon2.__anon1.structExternal->outgoing;
1972
1973 for(e = ((struct TopoEdge *)(uintptr_t)((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)__internalLinkList + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->first); e; e = (struct TopoEdge *)((struct __ecereNameSpace__ecere__com__IteratorPointer * (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__IteratorPointer * pointer))__extension__ ({
1974 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = __internalLinkList;
1975
1976 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1977 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_GetNext])(__internalLinkList, (struct __ecereNameSpace__ecere__com__IteratorPointer *)e))
1978 __ecereMethod_External_CreateUniqueEdge(e->to, external, e->breakable);
1979 }
1980 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), symbol->__anon2.__anon1.structExternal);
1981 FreeExternal(symbol->__anon2.__anon1.structExternal);
1982 }
1983 symbol->__anon2.__anon1.structExternal = external;
1984 external->__anon1.declaration = MkDeclaration(specs, declarators);
1985 after = external;
1986 symbol->declaredStruct = 1;
1987 }
1988 else
1989 {
1990 curExternal = external->prev;
1991 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(defs, external);
1992 FreeExternal(external);
1993 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
1994 }
1995 if((*classDataList).count)
1996 {
1997 char classDataStructName[1024];
1998 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1999 struct External * external;
2000
2001 strcpy(classDataStructName, "__ecereClassData_");
2002 FullClassNameCat(classDataStructName, symbol->string, 0);
2003 declMode = structDeclMode = 0;
2004 ListAdd(specs, MkStructOrUnion(3, MkIdentifier(classDataStructName), classDataList));
2005 external = MkExternalDeclaration(MkDeclaration(specs, (((void *)0))));
2006 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(defs, after, external);
2007 after = external;
2008 symbol->classData = 1;
2009 }
2010 else
2011 (__ecereNameSpace__ecere__com__eSystem_Delete(classDataList), classDataList = 0);
2012 }
2013 if(inCompiler)
2014 {
2015 {
2016 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * declarators = MkList();
2017
2018 strcpy(className, "__ecereClass_");
2019 FullClassNameCat(className, symbol->string, 1);
2020 symbol->className = __ecereNameSpace__ecere__sys__CopyString(className);
2021 if(!strstr(sourceFile, ".main.ec"))
2022 ListAdd(specs, MkSpecifier(STATIC));
2023 ListAdd(specs, MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
2024 ListAdd(declarators, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(className))), (((void *)0))));
2025 symbol->__anon2.__anon1.pointerExternal = MkExternalDeclaration(MkDeclaration(specs, declarators));
2026 DeclareStruct(symbol->__anon2.__anon1.pointerExternal, "ecere::com::Class", 0, 1);
2027 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(defs, after, symbol->__anon2.__anon1.pointerExternal);
2028 after = symbol->__anon2.__anon3.methodExternal;
2029 }
2030 if(symbol->needDestructor)
2031 {
2032 struct ClassFunction * function;
2033 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
2034 struct Declarator * decl;
2035 struct Statement * body;
2036 struct Context * context;
2037 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0)), * statements;
2038
2039 strcpy(destructorName, "__ecereDestructor_");
2040 FullClassNameCat(destructorName, symbol->string, 0);
2041 symbol->destructorName = __ecereNameSpace__ecere__sys__CopyString(destructorName);
2042 ListAdd(specs, MkSpecifier(VOID));
2043 context = PushContext();
2044 statements = MkList();
2045 if(definitions != (((void *)0)))
2046 {
2047 for(def = definitions->first; def; def = def->next)
2048 {
2049 if(def->type == 2 && def->__anon1.decl && def->__anon1.decl->type == 2)
2050 {
2051 struct Instantiation * inst = def->__anon1.decl->__anon1.inst;
2052 struct Symbol * classSym = inst->_class->__anon1.__anon1.symbol;
2053
2054 if(inst->exp && (!classSym || !classSym->__anon1.registered || classSym->__anon1.registered->type == 0))
2055 {
2056 struct Expression * exp = MkExpOp((((void *)0)), DELETE, CopyExpression(inst->exp));
2057
2058 ListAdd(statements, MkExpressionStmt(MkListOne(exp)));
2059 }
2060 if(inst->exp && (!classSym || !classSym->__anon1.registered || classSym->__anon1.registered->type == 5))
2061 {
2062 struct Expression * exp = MkExpOp((((void *)0)), DELETE, CopyExpression(inst->exp));
2063
2064 ListAdd(statements, MkExpressionStmt(MkListOne(exp)));
2065 }
2066 }
2067 }
2068 }
2069 if(destructor && destructor->body)
2070 {
2071 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*statements), (((void *)0)), destructor->body);
2072 destructor->body->__anon1.compound.context->parent = context;
2073 destructor->body = (((void *)0));
2074 }
2075 body = MkCompoundStmt(declarations, statements);
2076 PopContext(context);
2077 body->__anon1.compound.context = context;
2078 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(destructorName)), (((void *)0)));
2079 decl->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2080 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), decl->symbol);
2081 function = MkClassFunction(specs, (((void *)0)), decl, (((void *)0)));
2082 ProcessClassFunctionBody(function, body);
2083 function->dontMangle = 1;
2084 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, (((void *)0)), MkClassDefFunction(function));
2085 }
2086 if(symbol->needConstructor && inCompiler)
2087 {
2088 struct ClassFunction * function;
2089 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
2090 struct Declarator * decl;
2091 struct Statement * body;
2092 struct Context * context;
2093 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0)), * statements;
2094
2095 strcpy(constructorName, "__ecereConstructor_");
2096 FullClassNameCat(constructorName, symbol->string, 0);
2097 symbol->constructorName = __ecereNameSpace__ecere__sys__CopyString(constructorName);
2098 ListAdd(specs, MkSpecifierName("bool"));
2099 context = PushContext();
2100 statements = MkList();
2101 if(definitions != (((void *)0)))
2102 {
2103 for(def = definitions->first; def; def = def->next)
2104 {
2105 if(def->type == 2 && def->__anon1.decl && def->__anon1.decl->type == 2)
2106 {
2107 struct Instantiation * inst = def->__anon1.decl->__anon1.inst;
2108 struct Symbol * classSym = inst->_class->__anon1.__anon1.symbol;
2109
2110 if(inst->exp && (!classSym || !classSym->__anon1.registered || classSym->__anon1.registered->type == 0 || classSym->__anon1.registered->type == 5))
2111 {
2112 struct Instantiation * newInst = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
2113
2114 *newInst = *inst;
2115 newInst->members = (((void *)0));
2116 newInst->exp = CopyExpression(inst->exp);
2117 newInst->_class = CopySpecifier(inst->_class);
2118 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpInstance(newInst))));
2119 inst->built = 1;
2120 }
2121 if(inst->exp && (!classSym || !classSym->__anon1.registered || classSym->__anon1.registered->type == 0))
2122 {
2123 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_IncRef")), MkListOne(CopyExpression(inst->exp))))));
2124 }
2125 }
2126 }
2127 for(def = definitions->first; def; def = def->next)
2128 {
2129 if(def->type == 1 && def->__anon1.defProperties)
2130 {
2131 struct MemberInit * propertyDef;
2132
2133 for(propertyDef = (*def->__anon1.defProperties).first; propertyDef; propertyDef = propertyDef->next)
2134 {
2135 struct Expression * memberExp;
2136 struct Identifier * id = (*propertyDef->identifiers).first;
2137
2138 if(id)
2139 {
2140 memberExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), id);
2141 for(id = id->next; id; id = id->next)
2142 memberExp = MkExpMember(memberExp, id);
2143 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(memberExp, '=', (propertyDef->initializer && propertyDef->initializer->type == 0 ? propertyDef->initializer->__anon1.exp : (((void *)0)))))));
2144 }
2145 if(propertyDef->initializer)
2146 {
2147 if(propertyDef->initializer->type == 0)
2148 propertyDef->initializer->__anon1.exp = (((void *)0));
2149 FreeInitializer(propertyDef->initializer);
2150 }
2151 propertyDef->initializer = (((void *)0));
2152 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*propertyDef->identifiers));
2153 }
2154 }
2155 }
2156 for(def = definitions->first; def; def = def->next)
2157 {
2158 if(def->type == 2 && def->__anon1.decl && def->__anon1.decl->type == 2)
2159 {
2160 struct Instantiation * inst = def->__anon1.decl->__anon1.inst;
2161 struct Symbol * classSym = inst->_class->__anon1.__anon1.symbol;
2162
2163 if(inst->exp || (!classSym || !classSym->__anon1.registered || classSym->__anon1.registered->type == 0 || classSym->__anon1.registered->type == 5))
2164 {
2165 if(!(inst->exp && (!classSym || !classSym->__anon1.registered || classSym->__anon1.registered->type == 0 || classSym->__anon1.registered->type == 5)) || (inst->members && (*inst->members).count))
2166 {
2167 def->__anon1.decl->__anon1.inst = (((void *)0));
2168 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpInstance(inst))));
2169 }
2170 }
2171 }
2172 }
2173 }
2174 if(constructor && constructor->body)
2175 {
2176 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*statements), constructor->body);
2177 constructor->body->__anon1.compound.context->parent = context;
2178 constructor->body = (((void *)0));
2179 }
2180 ListAdd(statements, MkReturnStmt(MkListOne(MkExpIdentifier(MkIdentifier("true")))));
2181 body = MkCompoundStmt(declarations, statements);
2182 PopContext(context);
2183 body->__anon1.compound.context = context;
2184 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(constructorName)), (((void *)0)));
2185 decl->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2186 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), decl->symbol);
2187 function = MkClassFunction(specs, (((void *)0)), decl, (((void *)0)));
2188 ProcessClassFunctionBody(function, body);
2189 function->dontMangle = 1;
2190 if(definitions != (((void *)0)))
2191 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, (((void *)0)), MkClassDefFunction(function));
2192 }
2193 }
2194 if(definitions != (((void *)0)))
2195 {
2196 for(def = definitions->first; def; def = def->next)
2197 {
2198 if(def->type == 3 && def->__anon1.propertyDef)
2199 {
2200 struct PropertyDef * propertyDef = def->__anon1.propertyDef;
2201 struct ClassDef * after = def;
2202 struct ClassDef * newDef;
2203
2204 if(inCompiler)
2205 {
2206 yylloc = propertyDef->loc;
2207 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->privateNameSpace) && def->memberAccess == 1)
2208 CheckPublicDataType(propertyDef->symbol->type, 1, "class property");
2209 else if(!symbol->isStatic)
2210 CheckPublicDataType(propertyDef->symbol->type, 2, "class property");
2211 }
2212 {
2213 {
2214 struct ClassFunction * func;
2215 struct Declarator * decl;
2216 char name[1024];
2217 struct __ecereNameSpace__ecere__sys__OldList * params;
2218
2219 if(propertyDef->getStmt && propertyDef->id)
2220 {
2221 strcpy(name, "__ecereProp_");
2222 FullClassNameCat(name, symbol->string, 0);
2223 strcat(name, "_Get_");
2224 FullClassNameCat(name, propertyDef->id->string, 1);
2225 params = MkList();
2226 if(propertyDef->symbol->type && propertyDef->symbol->type->kind == 8 && propertyDef->symbol->type->__anon1._class && propertyDef->symbol->type->__anon1._class->__anon1.registered && propertyDef->symbol->type->__anon1._class->__anon1.registered->type == 1)
2227 {
2228 ListAdd(params, MkTypeName(CopyList(propertyDef->specifiers, (void *)(CopySpecifier)), MkDeclaratorIdentifier(MkIdentifier("value"))));
2229 decl = PlugDeclarator(propertyDef->declarator, MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params));
2230 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), decl, (((void *)0)));
2231 }
2232 else
2233 {
2234 decl = PlugDeclarator(propertyDef->declarator, MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params));
2235 func = MkClassFunction(CopyList(propertyDef->specifiers, (void *)(CopySpecifier)), (((void *)0)), decl, (((void *)0)));
2236 }
2237 ProcessClassFunctionBody(func, propertyDef->getStmt);
2238 func->declarator->symbol = propertyDef->symbol;
2239 propertyDef->symbol->__anon2.__anon2.externalGet = (struct External *)func;
2240 func->dontMangle = 1;
2241 newDef = MkClassDefFunction(func);
2242 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2243 after = newDef;
2244 if(inCompiler)
2245 propertyDef->getStmt = (((void *)0));
2246 else
2247 func->body = (((void *)0));
2248 }
2249 if(propertyDef->setStmt && propertyDef->id)
2250 {
2251 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2252
2253 strcpy(name, "__ecereProp_");
2254 FullClassNameCat(name, symbol->string, 0);
2255 strcat(name, "_Set_");
2256 FullClassNameCat(name, propertyDef->id->string, 1);
2257 params = MkList();
2258 ListAdd(params, MkTypeName(CopyList(propertyDef->specifiers, (void *)(CopySpecifier)), PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value")))));
2259 if(propertyDef->__anon1.isDBProp)
2260 {
2261 struct Specifier * spec;
2262 struct __ecereNameSpace__ecere__sys__OldList * specs = ((struct TypeName *)(*params).last)->qualifiers;
2263
2264 for(spec = (*specs).first; spec; spec = spec->next)
2265 if(spec->type == 0 && spec->__anon1.specifier == CONST)
2266 break;
2267 if(!spec)
2268 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specs), (((void *)0)), MkSpecifier(CONST));
2269 }
2270 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
2271 {
2272 unsigned int isConversion = propertyDef->symbol->__anon1._property && propertyDef->symbol->__anon1._property->conversion;
2273 unsigned int useVoid = 0;
2274
2275 switch(regClass->type)
2276 {
2277 case 1:
2278 case 6:
2279 useVoid = 1;
2280 break;
2281 case 5:
2282 case 0:
2283 useVoid = !isConversion;
2284 break;
2285 default:
2286 useVoid = !isConversion;
2287 if(useVoid && !propertyDef->__anon1.isDBProp)
2288 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "set defined on type without storage for non-conversion property\n", (((void *)0))));
2289 }
2290 ListAdd(specifiers, useVoid ? MkSpecifier(VOID) : MkSpecifierName(regClass->fullName));
2291 }
2292 func = MkClassFunction(specifiers, (((void *)0)), decl, (((void *)0)));
2293 ProcessClassFunctionBody(func, propertyDef->setStmt);
2294 func->dontMangle = 1;
2295 func->declarator->symbol = propertyDef->symbol;
2296 propertyDef->symbol->__anon2.__anon2.externalSet = (struct External *)func;
2297 if(!propertyDef->__anon1.conversion && regClass->type == 0)
2298 func->propSet = propertyDef->symbol;
2299 newDef = MkClassDefFunction(func);
2300 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2301 after = newDef;
2302 if(inCompiler)
2303 propertyDef->setStmt = (((void *)0));
2304 else
2305 func->body = (((void *)0));
2306 }
2307 if(propertyDef->issetStmt && propertyDef->id)
2308 {
2309 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2310
2311 strcpy(name, "__ecereProp_");
2312 FullClassNameCat(name, symbol->string, 0);
2313 strcat(name, "_IsSet_");
2314 FullClassNameCat(name, propertyDef->id->string, 1);
2315 params = MkList();
2316 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
2317 ListAdd(specifiers, MkSpecifierName("bool"));
2318 func = MkClassFunction(specifiers, (((void *)0)), decl, (((void *)0)));
2319 ProcessClassFunctionBody(func, propertyDef->issetStmt);
2320 func->dontMangle = 1;
2321 func->declarator->symbol = propertyDef->symbol;
2322 propertyDef->symbol->__anon2.__anon2.externalIsSet = (struct External *)func;
2323 newDef = MkClassDefFunction(func);
2324 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2325 after = newDef;
2326 if(inCompiler)
2327 propertyDef->issetStmt = (((void *)0));
2328 else
2329 func->body = (((void *)0));
2330 }
2331 if(propertyDef->id && inCompiler)
2332 {
2333 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(symbol->__anon1.registered, propertyDef->id->string, privateModule);
2334 struct Declaration * decl;
2335 struct External * external;
2336 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2337
2338 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
2339 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*specifiers), MkSpecifierExtended(MkExtDeclAttrib(MkAttrib(ATTRIB, MkListOne(MkAttribute(__ecereNameSpace__ecere__sys__CopyString("unused"), (((void *)0))))))));
2340 ListAdd(specifiers, MkSpecifierName("Property"));
2341 strcpy(name, "__ecereProp_");
2342 FullClassNameCat(name, symbol->string, 0);
2343 strcat(name, "_");
2344 FullClassNameCat(name, propertyDef->id->string, 1);
2345 {
2346 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
2347
2348 ListAdd(list, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))));
2349 strcpy(name, "__ecerePropM_");
2350 FullClassNameCat(name, symbol->string, 0);
2351 strcat(name, "_");
2352 FullClassNameCat(name, propertyDef->id->string, 1);
2353 ListAdd(list, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))));
2354 decl = MkDeclaration(specifiers, list);
2355 }
2356 external = MkExternalDeclaration(decl);
2357 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
2358 external->symbol = propertyDef->symbol;
2359 propertyDef->symbol->__anon2.__anon2.externalPtr = external;
2360 if(inCompiler && prop && prop->symbol)
2361 ((struct Symbol *)prop->symbol)->__anon2.__anon2.externalPtr = external;
2362 }
2363 }
2364 }
2365 }
2366 else if(def->type == 10 && def->__anon1.propertyDef)
2367 {
2368 struct PropertyDef * propertyDef = def->__anon1.propertyDef;
2369 struct ClassDef * after = def;
2370 struct ClassDef * newDef;
2371
2372 {
2373 if(inCompiler)
2374 {
2375 yylloc = propertyDef->loc;
2376 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->privateNameSpace))
2377 CheckPublicDataType(propertyDef->symbol->type, 1, "classwide property");
2378 else if(!symbol->isStatic)
2379 CheckPublicDataType(propertyDef->symbol->type, 2, "classwide property");
2380 }
2381 {
2382 struct ClassFunction * func;
2383 struct Declarator * decl;
2384 char name[1024];
2385 struct __ecereNameSpace__ecere__sys__OldList * params;
2386
2387 if(propertyDef->getStmt && propertyDef->id)
2388 {
2389 struct Declarator * declId;
2390
2391 sprintf(name, "class::__ecereClassProp_");
2392 FullClassNameCat(name, symbol->string, 0);
2393 strcat(name, "_Get_");
2394 strcat(name, propertyDef->id->string);
2395 params = MkList();
2396 declId = MkDeclaratorIdentifier(MkIdentifier(name));
2397 {
2398 decl = MkDeclaratorFunction(declId, params);
2399 func = MkClassFunction(MkListOne(MkSpecifierName("uint64")), (((void *)0)), decl, (((void *)0)));
2400 }
2401 ProcessClassFunctionBody(func, propertyDef->getStmt);
2402 func->declarator->symbol = propertyDef->symbol;
2403 propertyDef->symbol->__anon2.__anon2.externalGet = (struct External *)func;
2404 func->dontMangle = 1;
2405 newDef = MkClassDefFunction(func);
2406 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2407 after = newDef;
2408 decl = PlugDeclarator(propertyDef->declarator, MkDeclaratorFunction((((void *)0)), (((void *)0))));
2409 func->type = ProcessType(propertyDef->specifiers, decl);
2410 FreeDeclarator(decl);
2411 if(func->type->__anon1.__anon2.returnType->kind == 8 && func->type->__anon1.__anon2.returnType->__anon1._class && func->type->__anon1.__anon2.returnType->__anon1._class->__anon1.registered && func->type->__anon1.__anon2.returnType->__anon1._class->__anon1.registered->type == 1)
2412 func->type->__anon1.__anon2.returnType->byReference = 1;
2413 func->type->__anon1.__anon2.returnType->passAsTemplate = 1;
2414 if(inCompiler)
2415 propertyDef->getStmt = (((void *)0));
2416 else
2417 func->body = (((void *)0));
2418 }
2419 if(propertyDef->setStmt && propertyDef->id)
2420 {
2421 struct Context * prevCurContext;
2422 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2423 struct Statement * body = propertyDef->setStmt;
2424 struct Declarator * ptrDecl;
2425 struct Expression * e;
2426
2427 strcpy(name, "class::__ecereClassProp_");
2428 FullClassNameCat(name, symbol->string, 0);
2429 strcat(name, "_Set_");
2430 strcat(name, propertyDef->id->string);
2431 params = MkList();
2432 prevCurContext = curContext;
2433 curContext = body->__anon1.compound.context;
2434 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorIdentifier(MkIdentifier("_value"))));
2435 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
2436 if(!body->__anon1.compound.declarations)
2437 body->__anon1.compound.declarations = MkList();
2438 if(propertyDef->symbol->type && propertyDef->symbol->type->kind == 8 && propertyDef->symbol->type->__anon1._class && propertyDef->symbol->type->__anon1._class->__anon1.registered && propertyDef->symbol->type->__anon1._class->__anon1.registered->type == 1)
2439 ptrDecl = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value"))));
2440 else
2441 ptrDecl = PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value")));
2442 e = MkExpIdentifier(MkIdentifier("_value"));
2443 if(__ecereProp_Type_Get_isPointerType(propertyDef->symbol->type))
2444 e = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), (((void *)0))), e);
2445 ListAdd(body->__anon1.compound.declarations, MkDeclaration(CopyList(propertyDef->specifiers, (void *)(CopySpecifier)), MkListOne(MkInitDeclarator(ptrDecl, MkInitializerAssignment(MkExpCast(MkTypeName(CopyList(propertyDef->specifiers, (void *)(CopySpecifier)), CopyDeclarator(propertyDef->declarator)), e))))));
2446 curContext = prevCurContext;
2447 {
2448 struct Symbol * sym = ptrDecl->symbol;
2449
2450 sym->isParam = 1;
2451 FreeType(sym->type);
2452 sym->type = ProcessType(propertyDef->specifiers, propertyDef->declarator);
2453 }
2454 ListAdd(specifiers, MkSpecifier(VOID));
2455 func = MkClassFunction(specifiers, (((void *)0)), decl, (((void *)0)));
2456 ProcessClassFunctionBody(func, propertyDef->setStmt);
2457 func->dontMangle = 1;
2458 func->declarator->symbol = propertyDef->symbol;
2459 propertyDef->symbol->__anon2.__anon2.externalSet = (struct External *)func;
2460 newDef = MkClassDefFunction(func);
2461 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2462 after = newDef;
2463 if(inCompiler)
2464 propertyDef->setStmt = (((void *)0));
2465 else
2466 func->body = (((void *)0));
2467 }
2468 }
2469 }
2470 }
2471 else if(def->type == 0 && def->__anon1.function->declarator)
2472 {
2473 struct ClassFunction * func = def->__anon1.function;
2474
2475 func->_class = regClass;
2476 if(!func->dontMangle)
2477 {
2478 struct Declarator * funcDecl = GetFuncDecl(func->declarator);
2479 struct Identifier * id = GetDeclId(funcDecl);
2480 struct __ecereNameSpace__ecere__com__Method * method;
2481
2482 if(!funcDecl->__anon1.function.parameters || !(*funcDecl->__anon1.function.parameters).first)
2483 {
2484 if(!funcDecl->__anon1.function.parameters)
2485 funcDecl->__anon1.function.parameters = MkList();
2486 ListAdd(funcDecl->__anon1.function.parameters, MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
2487 }
2488 method = __ecereNameSpace__ecere__com__eClass_FindMethod(regClass, id->string, privateModule);
2489 FreeSpecifier(id->_class);
2490 id->_class = (((void *)0));
2491 if(inCompiler && method)
2492 {
2493 char * newId = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (strlen(id->string) + strlen("__ecereMethod___ecereNameSpace__") + strlen(symbol->string) + 2));
2494
2495 newId[0] = '\0';
2496 ProcessMethodType(method);
2497 yylloc = def->loc;
2498 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->privateNameSpace) && method->memberAccess == 1)
2499 CheckPublicDataType(method->dataType, 1, "class method");
2500 strcpy(newId, "__ecereMethod_");
2501 FullClassNameCat(newId, symbol->string, 0);
2502 strcat(newId, "_");
2503 strcat(newId, id->string);
2504 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
2505 id->string = newId;
2506 if(method->type != 1)
2507 {
2508 if(method->symbol)
2509 {
2510 (__ecereNameSpace__ecere__com__eSystem_Delete(((struct Symbol *)method->symbol)->string), ((struct Symbol *)method->symbol)->string = 0);
2511 ((struct Symbol *)method->symbol)->string = __ecereNameSpace__ecere__sys__CopyString(newId);
2512 }
2513 }
2514 }
2515 }
2516 }
2517 }
2518 }
2519 if(initDeclarators != (((void *)0)))
2520 FreeList(initDeclarators, (void *)(FreeInitDeclarator));
2521 }
2522
2523 void PreProcessClassDefinitions()
2524 {
2525 struct External * external, * next;
2526
2527 curExternal = (((void *)0));
2528 if(ast)
2529 {
2530 for(external = (*ast).first; external; external = next)
2531 {
2532 next = external->next;
2533 curExternal = external;
2534 if(external->type == 2)
2535 {
2536 struct ClassDefinition * _class = external->__anon1._class;
2537
2538 if(_class->definitions)
2539 {
2540 ProcessClass(0, _class->definitions, _class->symbol, _class->baseSpecs, (((void *)0)), &_class->loc, ast, external->prev, (((void *)0)), (((void *)0)));
2541 }
2542 }
2543 else if(external->type == 1)
2544 {
2545 struct Declaration * declaration = external->__anon1.declaration;
2546
2547 if(declaration && declaration->type == 1)
2548 {
2549 if(declaration->__anon1.__anon1.specifiers)
2550 {
2551 struct Specifier * specifier;
2552
2553 for(specifier = (*declaration->__anon1.__anon1.specifiers).first; specifier; specifier = specifier->next)
2554 {
2555 if((specifier->type == 2 || specifier->type == 3 || specifier->type == 4) && specifier->__anon1.__anon2.id && specifier->__anon1.__anon2.id->string && (declaration->declMode || specifier->__anon1.__anon2.baseSpecs || (specifier->type == 2 && specifier->__anon1.__anon2.definitions)))
2556 {
2557 struct Symbol * symbol = FindClass(specifier->__anon1.__anon2.id->string);
2558
2559 if(symbol)
2560 {
2561 struct __ecereNameSpace__ecere__sys__OldList * initDeclarators = (((void *)0));
2562 struct ExtDecl * extDecl = specifier->__anon1.__anon2.extDeclStruct;
2563
2564 specifier->__anon1.__anon2.extDeclStruct = (((void *)0));
2565 if(inCompiler)
2566 {
2567 initDeclarators = declaration->__anon1.__anon1.declarators;
2568 declaration->__anon1.__anon1.declarators = (((void *)0));
2569 }
2570 ProcessClass((specifier->type == 4) ? 6 : 0, specifier->__anon1.__anon2.definitions, symbol, specifier->__anon1.__anon2.baseSpecs, specifier->__anon1.__anon2.list, &specifier->loc, ast, external->prev, initDeclarators, extDecl);
2571 }
2572 }
2573 }
2574 }
2575 }
2576 else if(declaration && inCompiler && declaration->type == 3)
2577 {
2578 yylloc = declaration->loc;
2579 if(declaration->declMode == 1)
2580 CheckPublicExpression(declaration->__anon1.__anon2.exp, 1);
2581 else if(declaration->declMode != 3)
2582 CheckPublicExpression(declaration->__anon1.__anon2.exp, 2);
2583 }
2584 }
2585 else if(external->type == 3)
2586 {
2587 }
2588 else if(inCompiler && external->type == 0)
2589 {
2590 yylloc = external->__anon1.function->loc;
2591 if(!external->__anon1.function->type)
2592 external->__anon1.function->type = ProcessType(external->__anon1.function->specifiers, external->__anon1.function->declarator);
2593 if(external->__anon1.function->declMode == 1)
2594 CheckPublicDataType(external->__anon1.function->type, 1, "function");
2595 else if(external->__anon1.function->declMode != 3)
2596 CheckPublicDataType(external->__anon1.function->type, 2, "function");
2597 }
2598 }
2599 }
2600 }
2601
2602 void __ecereRegisterModule_pass0(struct __ecereNameSpace__ecere__com__Instance * module)
2603 {
2604 struct __ecereNameSpace__ecere__com__Class __attribute__((unused)) * class;
2605
2606 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FullClassNameCat", "void FullClassNameCat(char * output, const char * className, bool includeTemplateParams)", FullClassNameCat, module, 1);
2607 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PreProcessClassDefinitions", "void PreProcessClassDefinitions(void)", PreProcessClassDefinitions, module, 1);
2608 }
2609