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