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