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