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