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