compiler/libec: Casts where function pointers are expected
[sdk] / compiler / bootstrap / ecc / bootstrap / ecc.c
1 /* Code generated from eC source file: ecc.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
41 #if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
42 #define _64BIT 1
43 #else
44 #define _64BIT 0
45 #endif
46
47 #define arch_PointerSize                  sizeof(void *)
48 #define structSize_Instance               (_64BIT ? 24 : 12)
49 #define structSize_Module                 (_64BIT ? 560 : 300)
50
51 struct __ecereNameSpace__ecere__com__Instance;
52
53 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
54
55 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
56
57 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
58
59 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
60
61 extern void __ecereNameSpace__ecere__com__eSystem_Delete(void *  memory);
62
63 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
64
65 struct __ecereNameSpace__ecere__sys__BTNode;
66
67 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
68
69 struct __ecereNameSpace__ecere__sys__BinaryTree
70 {
71 struct __ecereNameSpace__ecere__sys__BTNode * root;
72 int count;
73 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
74 void (*  FreeKey)(void *  key);
75 } __attribute__ ((gcc_struct));
76
77 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
78
79 struct __ecereNameSpace__ecere__sys__OldList
80 {
81 void *  first;
82 void *  last;
83 int count;
84 unsigned int offset;
85 unsigned int circ;
86 } __attribute__ ((gcc_struct));
87
88 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
89
90 struct __ecereNameSpace__ecere__com__Method
91 {
92 const char *  name;
93 struct __ecereNameSpace__ecere__com__Method * parent;
94 struct __ecereNameSpace__ecere__com__Method * left;
95 struct __ecereNameSpace__ecere__com__Method * right;
96 int depth;
97 int (*  function)();
98 int vid;
99 int type;
100 struct __ecereNameSpace__ecere__com__Class * _class;
101 void *  symbol;
102 const char *  dataTypeString;
103 struct Type * dataType;
104 int memberAccess;
105 } __attribute__ ((gcc_struct));
106
107 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
108
109 struct __ecereNameSpace__ecere__com__Property
110 {
111 struct __ecereNameSpace__ecere__com__Property * prev;
112 struct __ecereNameSpace__ecere__com__Property * next;
113 const char *  name;
114 unsigned int isProperty;
115 int memberAccess;
116 int id;
117 struct __ecereNameSpace__ecere__com__Class * _class;
118 const char *  dataTypeString;
119 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
120 struct Type * dataType;
121 void (*  Set)(void * , int);
122 int (*  Get)(void * );
123 unsigned int (*  IsSet)(void * );
124 void *  data;
125 void *  symbol;
126 int vid;
127 unsigned int conversion;
128 unsigned int watcherOffset;
129 const char *  category;
130 unsigned int compiled;
131 unsigned int selfWatchable;
132 unsigned int isWatchable;
133 } __attribute__ ((gcc_struct));
134
135 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
136
137 struct CodePosition
138 {
139 int line;
140 int charPos;
141 int pos;
142 int included;
143 } __attribute__ ((gcc_struct));
144
145 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
146
147 struct Location
148 {
149 struct CodePosition start;
150 struct CodePosition end;
151 } __attribute__ ((gcc_struct));
152
153 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
154
155 struct Attrib;
156
157 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
158
159 struct ExtDecl;
160
161 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
162
163 struct ClassDefinition;
164
165 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
166
167 struct Context
168 {
169 struct Context * parent;
170 struct __ecereNameSpace__ecere__sys__BinaryTree types;
171 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
172 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
173 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
174 int nextID;
175 int simpleID;
176 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
177 struct ClassDefinition * classDef;
178 unsigned int templateTypesOnly;
179 unsigned int hasNameSpace;
180 } __attribute__ ((gcc_struct));
181
182 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
183
184 struct Instantiation;
185
186 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
187
188 struct Declaration;
189
190 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
191
192 struct Statement;
193
194 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
195
196 struct TypeName;
197
198 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
199
200 struct Initializer;
201
202 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
203
204 struct __ecereNameSpace__ecere__com__DataValue
205 {
206 union
207 {
208 char c;
209 unsigned char uc;
210 short s;
211 unsigned short us;
212 int i;
213 unsigned int ui;
214 void *  p;
215 float f;
216 double d;
217 long long i64;
218 uint64 ui64;
219 } __attribute__ ((gcc_struct)) __anon1;
220 } __attribute__ ((gcc_struct));
221
222 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
223
224 struct Expression;
225
226 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
227
228 struct TemplateDatatype;
229
230 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
231
232 struct TemplateArgument;
233
234 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
235
236 struct TemplateParameter;
237
238 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
239
240 struct Specifier;
241
242 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
243
244 struct Identifier;
245
246 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
247
248 struct Declarator;
249
250 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
251
252 struct FunctionDefinition;
253
254 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
255
256 struct DBTableDef;
257
258 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
259
260 struct External;
261
262 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
263
264 struct ModuleImport
265 {
266 struct ModuleImport * prev;
267 struct ModuleImport * next;
268 char *  name;
269 struct __ecereNameSpace__ecere__sys__OldList classes;
270 struct __ecereNameSpace__ecere__sys__OldList functions;
271 int importType;
272 int importAccess;
273 } __attribute__ ((gcc_struct));
274
275 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
276
277 struct ClassImport
278 {
279 struct ClassImport * prev;
280 struct ClassImport * next;
281 char *  name;
282 struct __ecereNameSpace__ecere__sys__OldList methods;
283 struct __ecereNameSpace__ecere__sys__OldList properties;
284 unsigned int itself;
285 int isRemote;
286 } __attribute__ ((gcc_struct));
287
288 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
289
290 struct Symbol
291 {
292 char *  string;
293 struct Symbol * parent;
294 struct Symbol * left;
295 struct Symbol * right;
296 int depth;
297 struct Type * type;
298 union
299 {
300 struct __ecereNameSpace__ecere__com__Method * method;
301 struct __ecereNameSpace__ecere__com__Property * _property;
302 struct __ecereNameSpace__ecere__com__Class * registered;
303 } __attribute__ ((gcc_struct)) __anon1;
304 int id;
305 int idCode;
306 union
307 {
308 struct
309 {
310 struct External * pointerExternal;
311 struct External * structExternal;
312 } __attribute__ ((gcc_struct)) __anon1;
313 struct
314 {
315 struct External * externalGet;
316 struct External * externalSet;
317 struct External * externalPtr;
318 struct External * externalIsSet;
319 } __attribute__ ((gcc_struct)) __anon2;
320 struct
321 {
322 struct External * methodExternal;
323 struct External * methodCodeExternal;
324 } __attribute__ ((gcc_struct)) __anon3;
325 } __attribute__ ((gcc_struct)) __anon2;
326 unsigned int imported;
327 unsigned int declaredStructSym;
328 struct __ecereNameSpace__ecere__com__Class * _class;
329 unsigned int declaredStruct;
330 unsigned int needConstructor;
331 unsigned int needDestructor;
332 char *  constructorName;
333 char *  structName;
334 char *  className;
335 char *  destructorName;
336 struct ModuleImport * module;
337 struct ClassImport * _import;
338 struct Location nameLoc;
339 unsigned int isParam;
340 unsigned int isRemote;
341 unsigned int isStruct;
342 unsigned int fireWatchersDone;
343 int declaring;
344 unsigned int classData;
345 unsigned int isStatic;
346 char *  shortName;
347 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
348 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
349 struct Context * ctx;
350 int isIterator;
351 struct Expression * propCategory;
352 } __attribute__ ((gcc_struct));
353
354 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
355
356 struct Type;
357
358 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
359
360 struct __ecereNameSpace__ecere__com__Class
361 {
362 struct __ecereNameSpace__ecere__com__Class * prev;
363 struct __ecereNameSpace__ecere__com__Class * next;
364 const char *  name;
365 int offset;
366 int structSize;
367 int (* *  _vTbl)();
368 int vTblSize;
369 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
370 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
371 int offsetClass;
372 int sizeClass;
373 struct __ecereNameSpace__ecere__com__Class * base;
374 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
375 struct __ecereNameSpace__ecere__sys__BinaryTree members;
376 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
377 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
378 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
379 struct __ecereNameSpace__ecere__sys__OldList derivatives;
380 int memberID;
381 int startMemberID;
382 int type;
383 struct __ecereNameSpace__ecere__com__Instance * module;
384 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
385 const char *  dataTypeString;
386 struct Type * dataType;
387 int typeSize;
388 int defaultAlignment;
389 void (*  Initialize)();
390 int memberOffset;
391 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
392 const char *  designerClass;
393 unsigned int noExpansion;
394 const char *  defaultProperty;
395 unsigned int comRedefinition;
396 int count;
397 int isRemote;
398 unsigned int internalDecl;
399 void *  data;
400 unsigned int computeSize;
401 int structAlignment;
402 int destructionWatchOffset;
403 unsigned int fixed;
404 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
405 int inheritanceAccess;
406 const char *  fullName;
407 void *  symbol;
408 struct __ecereNameSpace__ecere__sys__OldList conversions;
409 struct __ecereNameSpace__ecere__sys__OldList templateParams;
410 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
411 struct __ecereNameSpace__ecere__com__Class * templateClass;
412 struct __ecereNameSpace__ecere__sys__OldList templatized;
413 int numParams;
414 unsigned int isInstanceClass;
415 unsigned int byValueSystemClass;
416 } __attribute__ ((gcc_struct));
417
418 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name);
419
420 extern void __ecereNameSpace__ecere__com__eClass_SetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, long long value);
421
422 extern void __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
423
424 extern void __ecereNameSpace__ecere__com__eInstance_SetMethod(struct __ecereNameSpace__ecere__com__Instance * instance, const char *  name, void *  function);
425
426 extern void __ecereNameSpace__ecere__com__eInstance_IncRef(struct __ecereNameSpace__ecere__com__Instance * instance);
427
428 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);
429
430 extern void __ecereNameSpace__ecere__com__eInstance_Watch(void *  instance, struct __ecereNameSpace__ecere__com__Property * _property, void *  object, void (*  callback)(void * , void * ));
431
432 extern void __ecereNameSpace__ecere__com__eInstance_FireWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
433
434 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
435
436 struct __ecereNameSpace__ecere__com__Instance
437 {
438 int (* *  _vTbl)();
439 struct __ecereNameSpace__ecere__com__Class * _class;
440 int _refCount;
441 } __attribute__ ((gcc_struct));
442
443 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
444
445 struct __ecereNameSpace__ecere__com__DataMember
446 {
447 struct __ecereNameSpace__ecere__com__DataMember * prev;
448 struct __ecereNameSpace__ecere__com__DataMember * next;
449 const char *  name;
450 unsigned int isProperty;
451 int memberAccess;
452 int id;
453 struct __ecereNameSpace__ecere__com__Class * _class;
454 const char *  dataTypeString;
455 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
456 struct Type * dataType;
457 int type;
458 int offset;
459 int memberID;
460 struct __ecereNameSpace__ecere__sys__OldList members;
461 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
462 int memberOffset;
463 int structAlignment;
464 } __attribute__ ((gcc_struct));
465
466 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
467
468 struct __ecereNameSpace__ecere__com__SerialBuffer
469 {
470 unsigned char *  _buffer;
471 unsigned int count;
472 unsigned int _size;
473 unsigned int pos;
474 } __attribute__ ((gcc_struct));
475
476 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
477
478 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
479 {
480 union
481 {
482 struct
483 {
484 const char *  dataTypeString;
485 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
486 } __attribute__ ((gcc_struct)) __anon1;
487 struct __ecereNameSpace__ecere__com__DataValue expression;
488 struct
489 {
490 const char *  memberString;
491 union
492 {
493 struct __ecereNameSpace__ecere__com__DataMember * member;
494 struct __ecereNameSpace__ecere__com__Property * prop;
495 struct __ecereNameSpace__ecere__com__Method * method;
496 } __attribute__ ((gcc_struct)) __anon1;
497 } __attribute__ ((gcc_struct)) __anon2;
498 } __attribute__ ((gcc_struct)) __anon1;
499 } __attribute__ ((gcc_struct));
500
501 static struct Context * globalContext;
502
503 static struct __ecereNameSpace__ecere__com__Instance * privateModule;
504
505 static struct ModuleImport * mainModule;
506
507 struct __ecereNameSpace__ecere__sys__OldList _excludedSymbols =
508 {
509 0, 0, 0, (unsigned int)(uintptr_t)&((struct Symbol *)(void * )0)->left, 0
510 };
511
512 static struct __ecereNameSpace__ecere__sys__OldList defines, imports;
513
514 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
515
516 struct __ecereNameSpace__ecere__com__NameSpace
517 {
518 const char *  name;
519 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
520 struct __ecereNameSpace__ecere__com__NameSpace *  left;
521 struct __ecereNameSpace__ecere__com__NameSpace *  right;
522 int depth;
523 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
524 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
525 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
526 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
527 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
528 } __attribute__ ((gcc_struct));
529
530 static struct __ecereNameSpace__ecere__com__NameSpace globalData;
531
532 extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__sys__FileOpen(const char *  fileName, int mode);
533
534 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
535
536 struct MethodImport
537 {
538 struct MethodImport * prev;
539 struct MethodImport * next;
540 char *  name;
541 unsigned int isVirtual;
542 } __attribute__ ((gcc_struct));
543
544 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
545
546 struct PropertyImport
547 {
548 struct PropertyImport * prev;
549 struct PropertyImport * next;
550 char *  name;
551 unsigned int isVirtual;
552 unsigned int hasSet;
553 unsigned int hasGet;
554 } __attribute__ ((gcc_struct));
555
556 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
557
558 struct FunctionImport
559 {
560 struct FunctionImport * prev;
561 struct FunctionImport * next;
562 char *  name;
563 } __attribute__ ((gcc_struct));
564
565 int __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(struct __ecereNameSpace__ecere__com__Instance * this, const char *  format, ...);
566
567 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
568
569 static void OutputImports(char * fileName)
570 {
571 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__sys__FileOpen(fileName, 2);
572
573 if(f)
574 {
575 if(imports.first)
576 {
577 struct ModuleImport * module;
578
579 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "[Imported Modules]\n");
580 for(module = imports.first; module; module = module->next)
581 {
582 struct ClassImport * _class;
583 struct FunctionImport * function;
584
585 if(module->name)
586 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   %s\n", module->name);
587 else
588 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   [This]\n");
589 if(module->importType == 1)
590 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Static]\n");
591 else if(module->importType == 2)
592 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Remote]\n");
593 if(module->importAccess == 2)
594 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Private]\n");
595 else
596 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Public]\n");
597 if(module->classes.first)
598 {
599 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Imported Classes]\n");
600 for(_class = module->classes.first; _class; _class = _class->next)
601 {
602 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         %s\n", _class->name);
603 if(_class->itself)
604 {
605 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            [Instantiated]\n");
606 }
607 if(_class->isRemote)
608 {
609 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            [Remote]\n");
610 }
611 if(_class->methods.first)
612 {
613 struct MethodImport * method;
614
615 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            [Imported Methods]\n");
616 for(method = _class->methods.first; method; method = method->next)
617 {
618 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "               %s\n", method->name);
619 if(method->isVirtual)
620 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "                  [Virtual]\n");
621 }
622 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "               .\n");
623 }
624 if(_class->properties.first)
625 {
626 struct PropertyImport * prop;
627
628 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            [Imported Properties]\n");
629 for(prop = _class->properties.first; prop; prop = prop->next)
630 {
631 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "               %s\n", prop->name);
632 if(prop->isVirtual)
633 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "                  [Virtual]\n");
634 if(prop->hasSet)
635 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "                  [Set]\n");
636 if(prop->hasGet)
637 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "                  [Get]\n");
638 }
639 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "               .\n");
640 }
641 }
642 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "        .\n");
643 }
644 if(module->functions.first)
645 {
646 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Imported Functions]\n");
647 for(function = module->functions.first; function; function = function->next)
648 {
649 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         %s\n", function->name);
650 }
651 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "        .\n");
652 }
653 }
654 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   .\n");
655 }
656 }
657 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
658 }
659
660 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_CompilerApp;
661
662 extern int GetHostBits(void);
663
664 extern void SetSymbolsDir(const char *  s);
665
666 extern int strcmp(const char * , const char * );
667
668 extern size_t strlen(const char * );
669
670 extern char *  strcpy(char * , const char * );
671
672 extern char *  PassArg(char *  output, const char *  input);
673
674 extern void SetBuildingEcereCom(unsigned int b);
675
676 extern void SetBuildingEcereComModule(unsigned int b);
677
678 extern char *  __ecereNameSpace__ecere__sys__CopyString(const char *  string);
679
680 extern const char *  GetOutputFile(void);
681
682 extern void SetOutputFile(const char *  s);
683
684 extern const char *  GetSourceFile(void);
685
686 extern void SetSourceFile(const char *  s);
687
688 extern void SetI18nModuleName(const char *  s);
689
690 extern void SetMemoryGuard(unsigned int b);
691
692 extern void SetDefaultNameSpace(const char *  s);
693
694 extern void SetStrictNameSpaces(unsigned int b);
695
696 extern void SetOutputLineNumbers(unsigned int value);
697
698 extern char *  __ecereNameSpace__ecere__sys__PathCat(char *  string, const char *  addedPath);
699
700 extern char *  __ecereNameSpace__ecere__sys__ChangeExtension(const char *  string, const char *  ext, char *  output);
701
702 extern int printf(const char * , ...);
703
704 extern const char *  __ecereNameSpace__ecere__GetTranslatedString(const char * name, const char *  string, const char *  stringAndContext);
705
706 extern void SetGlobalData(struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace);
707
708 extern void SetExcludedSymbols(struct __ecereNameSpace__ecere__sys__OldList *  list);
709
710 extern void SetGlobalContext(struct Context * context);
711
712 extern void SetCurrentContext(struct Context * context);
713
714 extern void SetTopContext(struct Context * context);
715
716 extern void SetDefines(struct __ecereNameSpace__ecere__sys__OldList *  list);
717
718 extern void SetImports(struct __ecereNameSpace__ecere__sys__OldList *  list);
719
720 extern void SetInCompiler(unsigned int b);
721
722 extern void SetTargetPlatform(int platform);
723
724 extern void SetTargetBits(int bits);
725
726 extern void SetEchoOn(unsigned int b);
727
728 extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__com____ecere_COM_Initialize(unsigned int guiApp, int argc, char *  argv[]);
729
730 extern void SetPrivateModule(struct __ecereNameSpace__ecere__com__Instance * module);
731
732 extern struct Type * ProcessTypeString(const char *  string, unsigned int staticMethod);
733
734 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
735
736 struct GlobalData
737 {
738 uintptr_t key;
739 struct __ecereNameSpace__ecere__sys__BTNode * parent;
740 struct __ecereNameSpace__ecere__sys__BTNode * left;
741 struct __ecereNameSpace__ecere__sys__BTNode * right;
742 int depth;
743 struct __ecereNameSpace__ecere__com__Instance * module;
744 char *  dataTypeString;
745 struct Type * dataType;
746 void *  symbol;
747 char *  fullName;
748 } __attribute__ ((gcc_struct));
749
750 extern int snprintf(char * , size_t, const char * , ...);
751
752 extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__sys__DualPipeOpen(unsigned int mode, const char *  commandLine);
753
754 extern void SetFileInput(struct __ecereNameSpace__ecere__com__Instance * file);
755
756 extern void SetMainModule(struct ModuleImport * moduleImport);
757
758 extern char *  __ecereNameSpace__ecere__sys__GetLastDirectory(const char *  string, char *  output);
759
760 extern unsigned int __ecereNameSpace__ecere__sys__StripExtension(char *  string);
761
762 extern void resetScanner(void);
763
764 extern const char *  GetSymbolsDir(void);
765
766 extern unsigned int LoadSymbols(const char *  fileName, int importType, unsigned int loadDllOnly);
767
768 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ImportedModule;
769
770 struct ImportedModule
771 {
772 struct ImportedModule * prev;
773 struct ImportedModule * next;
774 char *  name;
775 int type;
776 int importType;
777 unsigned int globalInstance;
778 unsigned int dllOnly;
779 int importAccess;
780 } __attribute__ ((gcc_struct));
781
782 extern int strcasecmp(const char * , const char * );
783
784 extern unsigned int GetEcereImported(void);
785
786 extern unsigned int GetBuildingEcereCom(void);
787
788 extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__com__eModule_LoadStrict(struct __ecereNameSpace__ecere__com__Instance * fromModule, const char *  name, int importAccess);
789
790 extern void ParseEc(void);
791
792 extern void CheckDataRedefinitions(void);
793
794 extern void SetYydebug(unsigned int b);
795
796 extern void SetCurrentNameSpace(const char *  s);
797
798 extern void SetDeclMode(int accessMode);
799
800 extern struct __ecereNameSpace__ecere__sys__OldList *  GetAST(void);
801
802 extern void ProcessDBTableDefinitions(void);
803
804 extern void PrePreProcessClassDefinitions(void);
805
806 extern void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module);
807
808 extern void PreProcessClassDefinitions(void);
809
810 extern void ProcessClassDefinitions(void);
811
812 extern void ComputeDataTypes(void);
813
814 extern void ProcessInstantiations(void);
815
816 extern void ProcessMemberAccess(void);
817
818 extern void ProcessInstanceDeclarations(void);
819
820 extern void OutputTree(struct __ecereNameSpace__ecere__sys__OldList * ast, struct __ecereNameSpace__ecere__com__Instance * f);
821
822 extern void FreeASTTree(struct __ecereNameSpace__ecere__sys__OldList * ast);
823
824 extern void FreeContext(struct Context * context);
825
826 extern void FreeExcludedSymbols(struct __ecereNameSpace__ecere__sys__OldList * excludedSymbols);
827
828 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Definition;
829
830 struct Definition;
831
832 extern void FreeModuleDefine(struct Definition * def);
833
834 extern void FreeModuleImport(struct ModuleImport * imp);
835
836 extern void FreeTypeData(struct __ecereNameSpace__ecere__com__Instance * privateModule);
837
838 extern void FreeIncludeFiles(void);
839
840 extern void FreeGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * globalDataList);
841
842 extern void OutputIntlStrings(void);
843
844 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
845
846 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
847
848 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
849
850 struct __ecereNameSpace__ecere__com__Application
851 {
852 int argc;
853 const char * *  argv;
854 int exitCode;
855 unsigned int isGUIApp;
856 struct __ecereNameSpace__ecere__sys__OldList allModules;
857 char *  parsedCommand;
858 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
859 } __attribute__ ((gcc_struct));
860
861 const char *  __ecereProp___ecereNameSpace__ecere__com__Platform_Get_char__PTR_(int this);
862
863 int __ecereProp___ecereNameSpace__ecere__com__Platform_Set_char__PTR_(const char *  value);
864
865 extern struct __ecereNameSpace__ecere__com__Property * __ecereProp___ecereNameSpace__ecere__com__Platform_char__PTR_;
866
867 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
868
869 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
870
871 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
872
873 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Eof;
874
875 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__DualPipe;
876
877 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
878
879 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
880
881 int __ecereMethod___ecereNameSpace__ecere__sys__DualPipe_GetExitCode();
882
883 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
884
885 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Delete(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
886
887 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
888
889 void __ecereMethod_CompilerApp_Main(struct __ecereNameSpace__ecere__com__Instance * this)
890 {
891 char * cppCommand = (((void *)0));
892 char * cppOptions = (((void *)0));
893 int cppOptionsLen = 0;
894 int c;
895 unsigned int valid = 1;
896 char defaultOutputFile[797];
897 unsigned int buildingBootStrap = 0;
898 int targetPlatform = __runtimePlatform;
899 int targetBits = GetHostBits();
900
901 SetSymbolsDir("");
902 for(c = 1; c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc; c++)
903 {
904 const char * arg = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c];
905
906 if(arg[0] == '-')
907 {
908 if(!strcmp(arg + 1, "m32") || !strcmp(arg + 1, "m64"))
909 {
910 int newLen = cppOptionsLen + 1 + strlen(arg);
911
912 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (newLen + 1));
913 cppOptions[cppOptionsLen] = ' ';
914 strcpy(cppOptions + cppOptionsLen + 1, arg);
915 cppOptionsLen = newLen;
916 targetBits = !strcmp(arg + 1, "m32") ? 32 : 64;
917 }
918 else if(!strcmp(arg + 1, "t32") || !strcmp(arg + 1, "t64"))
919 {
920 targetBits = !strcmp(arg + 1, "t32") ? 32 : 64;
921 }
922 else if(arg[1] == 'D' || arg[1] == 'I')
923 {
924 char * buf;
925 int size = cppOptionsLen + 1 + strlen(arg) * 2 + 1;
926
927 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
928 buf = cppOptions + cppOptionsLen;
929 *buf++ = ' ';
930 PassArg(buf, arg);
931 cppOptionsLen = cppOptionsLen + 1 + strlen(buf);
932 if(arg[1] == 'D')
933 {
934 if(!strcmp(arg, "-DBUILDING_ECERE_COM"))
935 SetBuildingEcereCom(1);
936 else if(!strcmp(arg, "-DECERE_COM_MODULE"))
937 SetBuildingEcereComModule(1);
938 else if(!strcmp(arg, "-DECERE_BOOTSTRAP"))
939 buildingBootStrap = 1;
940 }
941 }
942 else if(!strcmp(arg + 1, "t"))
943 {
944 if(++c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
945 targetPlatform = __ecereProp___ecereNameSpace__ecere__com__Platform_Set_char__PTR_(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c]);
946 else
947 valid = 0;
948 }
949 else if(!strcmp(arg + 1, "cpp"))
950 {
951 if(++c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
952 cppCommand = __ecereNameSpace__ecere__sys__CopyString(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c]);
953 else
954 valid = 0;
955 }
956 else if(!strcmp(arg + 1, "o"))
957 {
958 if(!GetOutputFile() && c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
959 {
960 SetOutputFile(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
961 c++;
962 }
963 else
964 valid = 0;
965 }
966 else if(!strcmp(arg + 1, "c"))
967 {
968 if(!GetSourceFile() && c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
969 {
970 SetSourceFile(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
971 c++;
972 }
973 else
974 valid = 0;
975 }
976 else if(!strcmp(arg + 1, "isystem") || !strcmp(arg + 1, "isysroot"))
977 {
978 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
979 {
980 char * buf;
981 const char * arg1 = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[++c];
982 int size = cppOptionsLen + 1 + strlen(arg) * 2 + strlen(arg1) * 2 + 1;
983
984 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
985 buf = cppOptions + cppOptionsLen;
986 *buf++ = ' ';
987 buf = PassArg(buf, arg);
988 *buf++ = ' ';
989 buf = PassArg(buf, arg1);
990 cppOptionsLen = buf - cppOptions;
991 }
992 else
993 valid = 0;
994 }
995 else if(!strcmp(arg + 1, "fno-diagnostics-show-caret"))
996 {
997 char * buf;
998 int size = cppOptionsLen + 1 + strlen(arg) * 2 + 1;
999
1000 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
1001 buf = cppOptions + cppOptionsLen;
1002 *buf++ = ' ';
1003 PassArg(buf, arg);
1004 cppOptionsLen = cppOptionsLen + 1 + strlen(buf);
1005 }
1006 else if(!strcmp(arg + 1, "symbols"))
1007 {
1008 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
1009 {
1010 SetSymbolsDir(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
1011 c++;
1012 }
1013 else
1014 valid = 0;
1015 }
1016 else if(!strcmp(arg + 1, "module"))
1017 {
1018 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
1019 {
1020 SetI18nModuleName(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
1021 c++;
1022 }
1023 else
1024 valid = 0;
1025 }
1026 else if(!strcmp(arg + 1, "memguard"))
1027 {
1028 SetMemoryGuard(1);
1029 }
1030 else if(!strcmp(arg + 1, "defaultns"))
1031 {
1032 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
1033 {
1034 SetDefaultNameSpace(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
1035 c++;
1036 }
1037 else
1038 valid = 0;
1039 }
1040 else if(!strcmp(arg + 1, "strictns"))
1041 {
1042 SetStrictNameSpaces(1);
1043 }
1044 else if(!strcmp(arg + 1, "nolinenumbers"))
1045 {
1046 SetOutputLineNumbers(0);
1047 }
1048 }
1049 else
1050 valid = 0;
1051 }
1052 if(valid)
1053 {
1054 if(!cppCommand)
1055 cppCommand = __ecereNameSpace__ecere__sys__CopyString("gcc");
1056 if(!GetSourceFile())
1057 valid = 0;
1058 else if(!GetOutputFile())
1059 {
1060 strcpy(defaultOutputFile, "");
1061 __ecereNameSpace__ecere__sys__PathCat(defaultOutputFile, GetSourceFile());
1062 __ecereNameSpace__ecere__sys__ChangeExtension(defaultOutputFile, "c", defaultOutputFile);
1063 SetOutputFile(defaultOutputFile);
1064 }
1065 }
1066 if(!valid)
1067 {
1068 printf(__ecereNameSpace__ecere__GetTranslatedString("ecc", "Syntax:\n   ecc [-t <target platform>] [-cpp <c preprocessor>] [-o <output>] [-module <module>] [-symbols <outputdir>] [-I<includedir>]* [-isystem <sysincludedir>]* [-D<definition>]* -c <input>\n", (((void *)0))));
1069 }
1070 else
1071 {
1072 struct __ecereNameSpace__ecere__com__Instance * cppOutput;
1073 char command[3075];
1074
1075 SetGlobalData(&globalData);
1076 SetExcludedSymbols(&_excludedSymbols);
1077 SetGlobalContext(globalContext);
1078 SetCurrentContext(globalContext);
1079 SetTopContext(globalContext);
1080 SetDefines(&defines);
1081 SetImports(&imports);
1082 SetInCompiler(1);
1083 SetTargetPlatform(targetPlatform);
1084 SetTargetBits(targetBits);
1085 SetEchoOn(0);
1086 privateModule = (struct __ecereNameSpace__ecere__com__Instance *)__ecereNameSpace__ecere__com____ecere_COM_Initialize((unsigned int)(1 | (targetBits == sizeof(uintptr_t) * 8 ? (unsigned int)0 : targetBits == 64 ? 2 : targetBits == 32 ? 4 : (unsigned int)0) | 8), 1, (((void *)0)));
1087 SetPrivateModule(privateModule);
1088 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1089 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1090
1091 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint"), __ecereInstance1->type = ProcessTypeString("unsigned int", 0), __ecereInstance1;
1092 }));
1093 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1094 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1095
1096 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint64"), __ecereInstance1->type = ProcessTypeString("unsigned int64", 0), __ecereInstance1;
1097 }));
1098 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1099 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1100
1101 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint32"), __ecereInstance1->type = ProcessTypeString("unsigned int", 0), __ecereInstance1;
1102 }));
1103 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1104 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1105
1106 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint16"), __ecereInstance1->type = ProcessTypeString("unsigned short", 0), __ecereInstance1;
1107 }));
1108 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1109 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1110
1111 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("byte"), __ecereInstance1->type = ProcessTypeString("unsigned char", 0), __ecereInstance1;
1112 }));
1113 if(buildingBootStrap)
1114 {
1115 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1116 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1117
1118 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("intptr_t"), __ecereInstance1->type = ProcessTypeString("intptr", 0), __ecereInstance1;
1119 }));
1120 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1121 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1122
1123 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uintptr_t"), __ecereInstance1->type = ProcessTypeString("uintptr", 0), __ecereInstance1;
1124 }));
1125 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1126 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1127
1128 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("ssize_t"), __ecereInstance1->type = ProcessTypeString("intsize", 0), __ecereInstance1;
1129 }));
1130 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1131 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1132
1133 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("size_t"), __ecereInstance1->type = ProcessTypeString("uintsize", 0), __ecereInstance1;
1134 }));
1135 }
1136 {
1137 struct GlobalData * data = (data = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_GlobalData), data->fullName = __ecereNameSpace__ecere__sys__CopyString("__thisModule"), data->dataTypeString = __ecereNameSpace__ecere__sys__CopyString("Module"), data->module = privateModule, data);
1138
1139 data->key = (uintptr_t)data->fullName;
1140 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalData.functions, (struct __ecereNameSpace__ecere__sys__BTNode *)data);
1141 }
1142 snprintf(command, sizeof (command), "%s%s -x c -E %s\"%s\"", cppCommand, cppOptions ? cppOptions : "", buildingBootStrap ? "" : "-include stdint.h -include sys/types.h ", GetSourceFile());
1143 command[sizeof (command) - 1] = (char)0;
1144 if((cppOutput = __ecereNameSpace__ecere__sys__DualPipeOpen((((unsigned int)(1))), command)))
1145 {
1146 char impFile[797];
1147 struct ImportedModule * module;
1148 char sourceFileName[274];
1149 char mainModuleName[274];
1150 int exitCode;
1151 struct __ecereNameSpace__ecere__sys__OldList * ast;
1152 struct __ecereNameSpace__ecere__com__Instance * fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1153
1154 SetFileInput(fileInput);
1155 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&imports, (mainModule = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ModuleImport)));
1156 SetMainModule(mainModule);
1157 __ecereNameSpace__ecere__sys__GetLastDirectory(GetSourceFile(), sourceFileName);
1158 strcpy(mainModuleName, sourceFileName);
1159 __ecereNameSpace__ecere__sys__StripExtension(mainModuleName);
1160 module = __extension__ ({
1161 struct ImportedModule * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ImportedModule);
1162
1163 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(mainModuleName), __ecereInstance1->type = 0, __ecereInstance1;
1164 });
1165 __ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&defines, module);
1166 resetScanner();
1167 while(!((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *))__extension__ ({
1168 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = cppOutput;
1169
1170 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__DualPipe->_vTbl;
1171 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Eof])(cppOutput))
1172 {
1173 char junk[4096];
1174 int count = ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
1175 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = cppOutput;
1176
1177 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__DualPipe->_vTbl;
1178 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(cppOutput, junk, 1, 4096);
1179
1180 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, const void *  buffer, unsigned int size, unsigned int count))__extension__ ({
1181 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
1182
1183 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1184 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, junk, 1, count);
1185 }
1186 exitCode = __ecereMethod___ecereNameSpace__ecere__sys__DualPipe_GetExitCode(cppOutput);
1187 (__ecereNameSpace__ecere__com__eInstance_DecRef(cppOutput), cppOutput = 0);
1188 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
1189 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
1190
1191 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1192 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
1193 {
1194 char symFile[274];
1195 char symLocation[797];
1196 struct ImportedModule * module, * next;
1197
1198 strcpy(symFile, sourceFileName);
1199 __ecereNameSpace__ecere__sys__ChangeExtension(symFile, "sym", symFile);
1200 strcpy(symLocation, GetSymbolsDir());
1201 __ecereNameSpace__ecere__sys__PathCat(symLocation, symFile);
1202 LoadSymbols(symLocation, 3, 0);
1203 for(module = defines.first; module; module = next)
1204 {
1205 next = module->next;
1206 if(module->type == 0 && (strcasecmp)(module->name, mainModuleName))
1207 {
1208 (__ecereNameSpace__ecere__com__eSystem_Delete(module->name), module->name = 0);
1209 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Delete(&defines, module);
1210 }
1211 }
1212 if(!GetEcereImported() && !GetBuildingEcereCom())
1213 __ecereNameSpace__ecere__com__eModule_LoadStrict(privateModule, "ecereCOM", 1);
1214 }
1215 ParseEc();
1216 CheckDataRedefinitions();
1217 SetYydebug(0);
1218 SetCurrentNameSpace((((void *)0)));
1219 SetDefaultNameSpace((((void *)0)));
1220 SetDeclMode(2);
1221 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
1222 SetFileInput((((void *)0)));
1223 ast = GetAST();
1224 if(!exitCode)
1225 {
1226 ProcessDBTableDefinitions();
1227 PrePreProcessClassDefinitions();
1228 ComputeModuleClasses(privateModule);
1229 PreProcessClassDefinitions();
1230 ComputeModuleClasses(privateModule);
1231 ProcessClassDefinitions();
1232 ComputeDataTypes();
1233 ProcessInstantiations();
1234 ProcessMemberAccess();
1235 ProcessInstanceDeclarations();
1236 strcpy(impFile, GetSymbolsDir());
1237 __ecereNameSpace__ecere__sys__PathCat(impFile, sourceFileName);
1238 __ecereNameSpace__ecere__sys__ChangeExtension(impFile, "imp", impFile);
1239 if(imports.first)
1240 OutputImports(impFile);
1241 if(!((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->exitCode)
1242 {
1243 struct __ecereNameSpace__ecere__com__Instance * output = __ecereNameSpace__ecere__sys__FileOpen(GetOutputFile(), 2);
1244
1245 if(output)
1246 {
1247 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "/* Code generated from eC source file: %s */\n", sourceFileName);
1248 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#if defined(_WIN32)\n");
1249 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __runtimePlatform 1\n");
1250 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#elif defined(__APPLE__)\n");
1251 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __runtimePlatform 3\n");
1252 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1253 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __runtimePlatform 2\n");
1254 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1255 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#if defined(__GNUC__)\n");
1256 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef long long int64;\n");
1257 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef unsigned long long uint64;\n");
1258 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#ifndef _WIN32\n");
1259 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __declspec(x)\n");
1260 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1261 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#elif defined(__TINYC__)\n");
1262 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#include <stdarg.h>\n");
1263 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __builtin_va_list va_list\n");
1264 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __builtin_va_start va_start\n");
1265 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __builtin_va_end va_end\n");
1266 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#ifdef _WIN32\n");
1267 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define strcasecmp stricmp\n");
1268 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define strncasecmp strnicmp\n");
1269 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __declspec(x) __attribute__((x))\n");
1270 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1271 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __declspec(x)\n");
1272 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1273 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef long long int64;\n");
1274 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef unsigned long long uint64;\n");
1275 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1276 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef __int64 int64;\n");
1277 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef unsigned __int64 uint64;\n");
1278 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1279 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#ifdef __BIG_ENDIAN__\n");
1280 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __ENDIAN_PAD(x) (8 - (x))\n");
1281 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1282 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __ENDIAN_PAD(x) 0\n");
1283 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1284 if(buildingBootStrap)
1285 {
1286 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#include <stdint.h>\n");
1287 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#include <sys/types.h>\n");
1288 }
1289 if(ast)
1290 OutputTree(ast, output);
1291 (__ecereNameSpace__ecere__com__eInstance_DecRef(output), output = 0);
1292 }
1293 }
1294 }
1295 else
1296 ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->exitCode = exitCode;
1297 if(ast)
1298 {
1299 FreeASTTree(ast);
1300 }
1301 }
1302 FreeContext(globalContext);
1303 FreeExcludedSymbols(&_excludedSymbols);
1304 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&defines, (void *)(FreeModuleDefine));
1305 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&imports, (void *)(FreeModuleImport));
1306 FreeTypeData(privateModule);
1307 FreeIncludeFiles();
1308 FreeGlobalData(&globalData);
1309 (__ecereNameSpace__ecere__com__eInstance_DecRef(privateModule), privateModule = 0);
1310 }
1311 (__ecereNameSpace__ecere__com__eSystem_Delete(cppCommand), cppCommand = 0);
1312 (__ecereNameSpace__ecere__com__eSystem_Delete(cppOptions), cppOptions = 0);
1313 SetSymbolsDir((((void *)0)));
1314 OutputIntlStrings();
1315 }
1316
1317 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, const char *  name, const char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
1318
1319 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
1320
1321 struct __ecereNameSpace__ecere__com__Module
1322 {
1323 struct __ecereNameSpace__ecere__com__Instance * application;
1324 struct __ecereNameSpace__ecere__sys__OldList classes;
1325 struct __ecereNameSpace__ecere__sys__OldList defines;
1326 struct __ecereNameSpace__ecere__sys__OldList functions;
1327 struct __ecereNameSpace__ecere__sys__OldList modules;
1328 struct __ecereNameSpace__ecere__com__Instance * prev;
1329 struct __ecereNameSpace__ecere__com__Instance * next;
1330 const char *  name;
1331 void *  library;
1332 void *  Unload;
1333 int importType;
1334 int origImportType;
1335 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
1336 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
1337 } __attribute__ ((gcc_struct));
1338
1339 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
1340
1341 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);
1342
1343 void __ecereRegisterModule_ecc(struct __ecereNameSpace__ecere__com__Instance * module)
1344 {
1345 struct __ecereNameSpace__ecere__com__Class __attribute__((unused)) * class;
1346
1347 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(0, "CompilerApp", "ecere::com::Application", 0, 0, (void *)0, (void *)0, module, 2, 1);
1348 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
1349 __ecereClass_CompilerApp = class;
1350 __ecereNameSpace__ecere__com__eClass_AddMethod(class, "Main", 0, __ecereMethod_CompilerApp_Main, 1);
1351 }
1352
1353 void __ecereUnregisterModule_ecc(struct __ecereNameSpace__ecere__com__Instance * module)
1354 {
1355
1356 }
1357
1358 int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_CompareString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, const char *  a, const char *  b);
1359
1360 void __ecereCreateModuleInstances_ecc()
1361 {
1362 globalContext = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
1363 (globalData.classes.CompareKey = (void *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_CompareString, globalData.defines.CompareKey = (void *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_CompareString, globalData.functions.CompareKey = (void *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_CompareString, globalData.nameSpaces.CompareKey = (void *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_CompareString);
1364 }
1365
1366 void __ecereDestroyModuleInstances_ecc()
1367 {
1368 ((globalContext ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor((void *)globalContext) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(globalContext)) : 0), globalContext = 0);
1369 }
1370