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