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