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