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