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