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