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