marked all generated bootstrap C source files with 'code generated from eC srouce...
[sdk] / compiler / bootstrap / ecc / bootstrap / ecc.c
1 /* Code generated from eC source file. */
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 } __attribute__ ((gcc_struct));
405
406 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
407
408 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
409
410 struct __ecereNameSpace__ecere__com__Instance
411 {
412 int (* *  _vTbl)();
413 struct __ecereNameSpace__ecere__com__Class * _class;
414 int _refCount;
415 } __attribute__ ((gcc_struct));
416
417 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
418
419 struct __ecereNameSpace__ecere__com__DataMember
420 {
421 struct __ecereNameSpace__ecere__com__DataMember * prev;
422 struct __ecereNameSpace__ecere__com__DataMember * next;
423 char *  name;
424 unsigned int isProperty;
425 int memberAccess;
426 int id;
427 struct __ecereNameSpace__ecere__com__Class * _class;
428 char *  dataTypeString;
429 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
430 struct Type * dataType;
431 int type;
432 int offset;
433 int memberID;
434 struct __ecereNameSpace__ecere__sys__OldList members;
435 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
436 int memberOffset;
437 int structAlignment;
438 } __attribute__ ((gcc_struct));
439
440 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
441
442 struct __ecereNameSpace__ecere__com__SerialBuffer
443 {
444 unsigned char *  _buffer;
445 unsigned int count;
446 unsigned int _size;
447 unsigned int pos;
448 } __attribute__ ((gcc_struct));
449
450 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
451
452 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
453 {
454 union
455 {
456 struct
457 {
458 char *  dataTypeString;
459 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
460 } __attribute__ ((gcc_struct));
461 struct __ecereNameSpace__ecere__com__DataValue expression;
462 struct
463 {
464 char *  memberString;
465 union
466 {
467 struct __ecereNameSpace__ecere__com__DataMember * member;
468 struct __ecereNameSpace__ecere__com__Property * prop;
469 struct __ecereNameSpace__ecere__com__Method * method;
470 } __attribute__ ((gcc_struct));
471 } __attribute__ ((gcc_struct));
472 } __attribute__ ((gcc_struct));
473 } __attribute__ ((gcc_struct));
474
475 static struct Context * globalContext;
476
477 static struct __ecereNameSpace__ecere__com__Instance * privateModule;
478
479 static struct ModuleImport * mainModule;
480
481 struct __ecereNameSpace__ecere__sys__OldList _excludedSymbols = 
482 {
483 0, 0, 0, (unsigned int)&((struct Symbol *)(void * )0)->left, 0
484 };
485
486 static struct __ecereNameSpace__ecere__sys__OldList defines, imports;
487
488 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
489
490 struct __ecereNameSpace__ecere__com__NameSpace
491 {
492 char *  name;
493 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
494 struct __ecereNameSpace__ecere__com__NameSpace *  left;
495 struct __ecereNameSpace__ecere__com__NameSpace *  right;
496 int depth;
497 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
498 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
499 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
500 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
501 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
502 } __attribute__ ((gcc_struct));
503
504 static struct __ecereNameSpace__ecere__com__NameSpace globalData;
505
506 extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__sys__FileOpen(char *  fileName, int mode);
507
508 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
509
510 struct MethodImport
511 {
512 struct MethodImport * prev;
513 struct MethodImport * next;
514 char *  name;
515 unsigned int isVirtual;
516 } __attribute__ ((gcc_struct));
517
518 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
519
520 struct PropertyImport
521 {
522 struct PropertyImport * prev;
523 struct PropertyImport * next;
524 char *  name;
525 unsigned int isVirtual;
526 unsigned int hasSet;
527 unsigned int hasGet;
528 } __attribute__ ((gcc_struct));
529
530 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
531
532 struct FunctionImport
533 {
534 struct FunctionImport * prev;
535 struct FunctionImport * next;
536 char *  name;
537 } __attribute__ ((gcc_struct));
538
539 int __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(struct __ecereNameSpace__ecere__com__Instance * this, char *  format, ...);
540
541 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
542
543 static void OutputImports(char * fileName)
544 {
545 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__sys__FileOpen(fileName, 2);
546
547 if(f)
548 {
549 if(imports.first)
550 {
551 struct ModuleImport * module;
552
553 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "[Imported Modules]\n");
554 for(module = imports.first; module; module = module->next)
555 {
556 struct ClassImport * _class;
557 struct FunctionImport * function;
558
559 if(module->name)
560 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   %s\n", module->name);
561 else
562 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   [This]\n");
563 if(module->importType == 1)
564 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Static]\n");
565 else if(module->importType == 2)
566 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Remote]\n");
567 if(module->importAccess == 2)
568 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Private]\n");
569 else
570 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Public]\n");
571 if(module->classes.first)
572 {
573 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Imported Classes]\n");
574 for(_class = module->classes.first; _class; _class = _class->next)
575 {
576 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         %s\n", _class->name);
577 if(_class->itself)
578 {
579 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            [Instantiated]\n");
580 }
581 if(_class->isRemote)
582 {
583 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            [Remote]\n");
584 }
585 if(_class->methods.first)
586 {
587 struct MethodImport * method;
588
589 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            [Imported Methods]\n");
590 for(method = _class->methods.first; method; method = method->next)
591 {
592 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "               %s\n", method->name);
593 if(method->isVirtual)
594 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "                  [Virtual]\n");
595 }
596 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "               .\n");
597 }
598 if(_class->properties.first)
599 {
600 struct PropertyImport * prop;
601
602 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            [Imported Properties]\n");
603 for(prop = _class->properties.first; prop; prop = prop->next)
604 {
605 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "               %s\n", prop->name);
606 if(prop->isVirtual)
607 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "                  [Virtual]\n");
608 if(prop->hasSet)
609 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "                  [Set]\n");
610 if(prop->hasGet)
611 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "                  [Get]\n");
612 }
613 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "               .\n");
614 }
615 }
616 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "        .\n");
617 }
618 if(module->functions.first)
619 {
620 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      [Imported Functions]\n");
621 for(function = module->functions.first; function; function = function->next)
622 {
623 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         %s\n", function->name);
624 }
625 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "        .\n");
626 }
627 }
628 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   .\n");
629 }
630 }
631 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
632 }
633
634 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_CompilerApp;
635
636 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
637
638 extern int GetHostBits(void);
639
640 extern void SetSymbolsDir(char *  s);
641
642 extern int strcmp(const char * , const char * );
643
644 extern size_t strlen(const char * );
645
646 extern char *  strcpy(char * , const char * );
647
648 extern char *  PassArg(char *  output, const char *  input);
649
650 extern void SetBuildingEcereCom(unsigned int b);
651
652 extern void SetBuildingEcereComModule(unsigned int b);
653
654 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
655
656 extern char *  GetOutputFile(void);
657
658 extern void SetOutputFile(char *  s);
659
660 extern char *  GetSourceFile(void);
661
662 extern void SetSourceFile(char *  s);
663
664 extern void SetMemoryGuard(unsigned int b);
665
666 extern void SetDefaultNameSpace(char *  s);
667
668 extern void SetStrictNameSpaces(unsigned int b);
669
670 extern void SetOutputLineNumbers(unsigned int value);
671
672 extern char *  __ecereNameSpace__ecere__sys__PathCat(char *  string, char *  addedPath);
673
674 extern char *  __ecereNameSpace__ecere__sys__ChangeExtension(char *  string, char *  ext, char *  output);
675
676 extern int printf(char * , ...);
677
678 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
679
680 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
681
682 extern void SetGlobalData(struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace);
683
684 extern void SetExcludedSymbols(struct __ecereNameSpace__ecere__sys__OldList *  list);
685
686 extern void SetGlobalContext(struct Context * context);
687
688 extern void SetCurrentContext(struct Context * context);
689
690 extern void SetTopContext(struct Context * context);
691
692 extern void SetDefines(struct __ecereNameSpace__ecere__sys__OldList *  list);
693
694 extern void SetImports(struct __ecereNameSpace__ecere__sys__OldList *  list);
695
696 extern void SetInCompiler(unsigned int b);
697
698 extern void SetTargetPlatform(int platform);
699
700 extern void SetTargetBits(int bits);
701
702 extern void SetEchoOn(unsigned int b);
703
704 extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__com____ecere_COM_Initialize(unsigned int guiApp, int argc, char *  argv[]);
705
706 extern void SetPrivateModule(struct __ecereNameSpace__ecere__com__Instance * module);
707
708 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
709
710 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
711
712 struct GlobalData
713 {
714 uintptr_t key;
715 struct __ecereNameSpace__ecere__sys__BTNode * parent;
716 struct __ecereNameSpace__ecere__sys__BTNode * left;
717 struct __ecereNameSpace__ecere__sys__BTNode * right;
718 int depth;
719 struct __ecereNameSpace__ecere__com__Instance * module;
720 char *  dataTypeString;
721 struct Type * dataType;
722 void *  symbol;
723 char *  fullName;
724 } __attribute__ ((gcc_struct));
725
726 extern int snprintf(char * , size_t, char * , ...);
727
728 extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__sys__DualPipeOpen(unsigned int mode, char *  commandLine);
729
730 extern void SetFileInput(struct __ecereNameSpace__ecere__com__Instance * file);
731
732 extern void SetMainModule(struct ModuleImport * moduleImport);
733
734 extern char *  __ecereNameSpace__ecere__sys__GetLastDirectory(char *  string, char *  output);
735
736 extern unsigned int __ecereNameSpace__ecere__sys__StripExtension(char *  string);
737
738 extern void resetScanner(void);
739
740 extern char *  GetSymbolsDir(void);
741
742 extern unsigned int LoadSymbols(char *  fileName, int importType, unsigned int loadDllOnly);
743
744 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ImportedModule;
745
746 struct ImportedModule
747 {
748 struct ImportedModule * prev;
749 struct ImportedModule * next;
750 char *  name;
751 int type;
752 int importType;
753 unsigned int globalInstance;
754 unsigned int dllOnly;
755 int importAccess;
756 } __attribute__ ((gcc_struct));
757
758 extern int strcasecmp(const char * , const char * );
759
760 extern unsigned int GetEcereImported(void);
761
762 extern unsigned int GetBuildingEcereCom(void);
763
764 extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__com__eModule_LoadStrict(struct __ecereNameSpace__ecere__com__Instance * fromModule, char *  name, int importAccess);
765
766 extern void ParseEc(void);
767
768 extern void CheckDataRedefinitions(void);
769
770 extern void SetYydebug(unsigned int b);
771
772 extern void SetCurrentNameSpace(char *  s);
773
774 extern void SetDeclMode(int accessMode);
775
776 extern struct __ecereNameSpace__ecere__sys__OldList *  GetAST(void);
777
778 extern void ProcessDBTableDefinitions(void);
779
780 extern void PrePreProcessClassDefinitions(void);
781
782 extern void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module);
783
784 extern void PreProcessClassDefinitions(void);
785
786 extern void ProcessClassDefinitions(void);
787
788 extern void ComputeDataTypes(void);
789
790 extern void ProcessInstantiations(void);
791
792 extern void ProcessMemberAccess(void);
793
794 extern void ProcessInstanceDeclarations(void);
795
796 extern void OutputTree(struct __ecereNameSpace__ecere__sys__OldList * ast, struct __ecereNameSpace__ecere__com__Instance * f);
797
798 extern void FreeASTTree(struct __ecereNameSpace__ecere__sys__OldList * ast);
799
800 extern void FreeContext(struct Context * context);
801
802 extern void FreeExcludedSymbols(struct __ecereNameSpace__ecere__sys__OldList * excludedSymbols);
803
804 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Definition;
805
806 struct Definition;
807
808 extern void FreeModuleDefine(struct Definition * def);
809
810 extern void FreeModuleImport(struct ModuleImport * imp);
811
812 extern void FreeTypeData(struct __ecereNameSpace__ecere__com__Instance * privateModule);
813
814 extern void FreeIncludeFiles(void);
815
816 extern void FreeGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * globalDataList);
817
818 extern void OutputIntlStrings(void);
819
820 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
821
822 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
823
824 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
825
826 struct __ecereNameSpace__ecere__com__Application
827 {
828 int argc;
829 char * *  argv;
830 int exitCode;
831 unsigned int isGUIApp;
832 struct __ecereNameSpace__ecere__sys__OldList allModules;
833 char *  parsedCommand;
834 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
835 } __attribute__ ((gcc_struct));
836
837 char *  __ecereProp___ecereNameSpace__ecere__com__Platform_Get_char__PTR_(int this);
838
839 int __ecereProp___ecereNameSpace__ecere__com__Platform_Set_char__PTR_(char *  value);
840
841 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__com__Platform_char__PTR_;
842
843 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
844
845 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
846
847 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
848
849 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Eof;
850
851 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
852
853 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
854
855 int __ecereMethod___ecereNameSpace__ecere__sys__DualPipe_GetExitCode();
856
857 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
858
859 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Delete(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
860
861 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
862
863 void __ecereMethod_CompilerApp_Main(struct __ecereNameSpace__ecere__com__Instance * this)
864 {
865 char * cppCommand = (((void *)0));
866 char * cppOptions = (((void *)0));
867 int cppOptionsLen = 0;
868 int c;
869 unsigned int valid = 0x1;
870 char defaultOutputFile[797];
871 unsigned int buildingBootStrap = 0x0;
872 int targetPlatform = __ecereNameSpace__ecere__com__GetRuntimePlatform();
873 int targetBits = GetHostBits();
874
875 SetSymbolsDir("");
876 for(c = 1; c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc; c++)
877 {
878 char * arg = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c];
879
880 if(arg[0] == '-')
881 {
882 if(!strcmp(arg + 1, "m32") || !strcmp(arg + 1, "m64"))
883 {
884 int newLen = cppOptionsLen + 1 + strlen(arg);
885
886 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (newLen + 1));
887 cppOptions[cppOptionsLen] = ' ';
888 strcpy(cppOptions + cppOptionsLen + 1, arg);
889 cppOptionsLen = newLen;
890 targetBits = !strcmp(arg + 1, "m32") ? 32 : 64;
891 }
892 else if(arg[1] == 'D' || arg[1] == 'I')
893 {
894 char * buf;
895 int size = cppOptionsLen + 1 + strlen(arg) * 2 + 1;
896
897 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
898 buf = cppOptions + cppOptionsLen;
899 *buf++ = ' ';
900 PassArg(buf, arg);
901 cppOptionsLen = cppOptionsLen + 1 + strlen(buf);
902 if(arg[1] == 'D')
903 {
904 if(!strcmp(arg, "-DBUILDING_ECERE_COM"))
905 SetBuildingEcereCom(0x1);
906 else if(!strcmp(arg, "-DECERE_COM_MODULE"))
907 SetBuildingEcereComModule(0x1);
908 else if(!strcmp(arg, "-DECERE_BOOTSTRAP"))
909 buildingBootStrap = 0x1;
910 }
911 }
912 else if(!strcmp(arg + 1, "t"))
913 {
914 if(++c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
915 targetPlatform = __ecereProp___ecereNameSpace__ecere__com__Platform_Set_char__PTR_(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c]);
916 else
917 valid = 0x0;
918 }
919 else if(!strcmp(arg + 1, "cpp"))
920 {
921 if(++c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
922 cppCommand = __ecereNameSpace__ecere__sys__CopyString(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c]);
923 else
924 valid = 0x0;
925 }
926 else if(!strcmp(arg + 1, "o"))
927 {
928 if(!GetOutputFile() && c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
929 {
930 SetOutputFile(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
931 c++;
932 }
933 else
934 valid = 0x0;
935 }
936 else if(!strcmp(arg + 1, "c"))
937 {
938 if(!GetSourceFile() && c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
939 {
940 SetSourceFile(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
941 c++;
942 }
943 else
944 valid = 0x0;
945 }
946 else if(!strcmp(arg + 1, "isystem") || !strcmp(arg + 1, "isysroot"))
947 {
948 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
949 {
950 char * buf;
951 char * arg1 = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[++c];
952 int size = cppOptionsLen + 1 + strlen(arg) * 2 + strlen(arg1) * 2 + 1;
953
954 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
955 buf = cppOptions + cppOptionsLen;
956 *buf++ = ' ';
957 buf = PassArg(buf, arg);
958 *buf++ = ' ';
959 buf = PassArg(buf, arg1);
960 cppOptionsLen = buf - cppOptions;
961 }
962 else
963 valid = 0x0;
964 }
965 else if(!strcmp(arg + 1, "symbols"))
966 {
967 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
968 {
969 SetSymbolsDir(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
970 c++;
971 }
972 else
973 valid = 0x0;
974 }
975 else if(!strcmp(arg + 1, "memguard"))
976 {
977 SetMemoryGuard(0x1);
978 }
979 else if(!strcmp(arg + 1, "defaultns"))
980 {
981 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
982 {
983 SetDefaultNameSpace(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
984 c++;
985 }
986 else
987 valid = 0x0;
988 }
989 else if(!strcmp(arg + 1, "strictns"))
990 {
991 SetStrictNameSpaces(0x1);
992 }
993 else if(!strcmp(arg + 1, "nolinenumbers"))
994 {
995 SetOutputLineNumbers(0x0);
996 }
997 }
998 else
999 valid = 0x0;
1000 }
1001 if(valid)
1002 {
1003 if(!cppCommand)
1004 cppCommand = __ecereNameSpace__ecere__sys__CopyString("gcc");
1005 if(!GetSourceFile())
1006 valid = 0x0;
1007 else if(!GetOutputFile())
1008 {
1009 strcpy(defaultOutputFile, "");
1010 __ecereNameSpace__ecere__sys__PathCat(defaultOutputFile, GetSourceFile());
1011 __ecereNameSpace__ecere__sys__ChangeExtension(defaultOutputFile, "c", defaultOutputFile);
1012 SetOutputFile(defaultOutputFile);
1013 }
1014 }
1015 if(!valid)
1016 {
1017 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))));
1018 }
1019 else
1020 {
1021 struct __ecereNameSpace__ecere__com__Instance * cppOutput;
1022 char command[3075LL];
1023
1024 SetGlobalData(&globalData);
1025 SetExcludedSymbols(&_excludedSymbols);
1026 SetGlobalContext(globalContext);
1027 SetCurrentContext(globalContext);
1028 SetTopContext(globalContext);
1029 SetDefines(&defines);
1030 SetImports(&imports);
1031 SetInCompiler(0x1);
1032 SetTargetPlatform(targetPlatform);
1033 SetTargetBits(targetBits);
1034 SetEchoOn(0x0);
1035 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)));
1036 SetPrivateModule(privateModule);
1037 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1038 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1039
1040 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint"), __ecereInstance1->type = ProcessTypeString("unsigned int", 0x0), __ecereInstance1;
1041 }));
1042 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1043 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1044
1045 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint64"), __ecereInstance1->type = ProcessTypeString("unsigned int64", 0x0), __ecereInstance1;
1046 }));
1047 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1048 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1049
1050 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint32"), __ecereInstance1->type = ProcessTypeString("unsigned int", 0x0), __ecereInstance1;
1051 }));
1052 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1053 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1054
1055 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint16"), __ecereInstance1->type = ProcessTypeString("unsigned short", 0x0), __ecereInstance1;
1056 }));
1057 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1058 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1059
1060 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("byte"), __ecereInstance1->type = ProcessTypeString("unsigned char", 0x0), __ecereInstance1;
1061 }));
1062 if(buildingBootStrap)
1063 {
1064 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1065 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1066
1067 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("intptr_t"), __ecereInstance1->type = ProcessTypeString("intptr", 0x0), __ecereInstance1;
1068 }));
1069 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1070 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1071
1072 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uintptr_t"), __ecereInstance1->type = ProcessTypeString("uintptr", 0x0), __ecereInstance1;
1073 }));
1074 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1075 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1076
1077 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("ssize_t"), __ecereInstance1->type = ProcessTypeString("intsize", 0x0), __ecereInstance1;
1078 }));
1079 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1080 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1081
1082 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("size_t"), __ecereInstance1->type = ProcessTypeString("uintsize", 0x0), __ecereInstance1;
1083 }));
1084 }
1085 {
1086 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);
1087
1088 data->key = (uintptr_t)data->fullName;
1089 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalData.functions, (struct __ecereNameSpace__ecere__sys__BTNode *)data);
1090 }
1091 snprintf(command, sizeof command, "%s%s -x c -E %s\"%s\"", cppCommand, cppOptions ? cppOptions : "", buildingBootStrap ? "" : "-include stdint.h -include sys/types.h ", GetSourceFile());
1092 command[sizeof command - 1] = (char)0;
1093 if((cppOutput = __ecereNameSpace__ecere__sys__DualPipeOpen((((unsigned int)(0x1))), command)))
1094 {
1095 char impFile[797];
1096 struct ImportedModule * module;
1097 char mainModuleName[274];
1098 int exitCode;
1099 struct __ecereNameSpace__ecere__sys__OldList * ast;
1100 struct __ecereNameSpace__ecere__com__Instance * fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1101
1102 SetFileInput(fileInput);
1103 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&imports, (mainModule = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ModuleImport)));
1104 SetMainModule(mainModule);
1105 __ecereNameSpace__ecere__sys__GetLastDirectory(GetSourceFile(), mainModuleName);
1106 __ecereNameSpace__ecere__sys__StripExtension(mainModuleName);
1107 module = __extension__ ({
1108 struct ImportedModule * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ImportedModule);
1109
1110 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(mainModuleName), __ecereInstance1->type = 0, __ecereInstance1;
1111 });
1112 __ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&defines, module);
1113 resetScanner();
1114 while(!((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *))cppOutput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Eof])(cppOutput))
1115 {
1116 char junk[4096];
1117 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);
1118
1119 ((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);
1120 }
1121 exitCode = __ecereMethod___ecereNameSpace__ecere__sys__DualPipe_GetExitCode(cppOutput);
1122 (__ecereNameSpace__ecere__com__eInstance_DecRef(cppOutput), cppOutput = 0);
1123 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
1124 {
1125 char symFile[274];
1126 char symLocation[797];
1127 struct ImportedModule * module, * next;
1128
1129 __ecereNameSpace__ecere__sys__GetLastDirectory(GetSourceFile(), symFile);
1130 __ecereNameSpace__ecere__sys__ChangeExtension(symFile, "sym", symFile);
1131 strcpy(symLocation, GetSymbolsDir());
1132 __ecereNameSpace__ecere__sys__PathCat(symLocation, symFile);
1133 LoadSymbols(symLocation, 3, 0x0);
1134 for(module = defines.first; module; module = next)
1135 {
1136 next = module->next;
1137 if(module->type == 0 && (strcasecmp)(module->name, mainModuleName))
1138 {
1139 (__ecereNameSpace__ecere__com__eSystem_Delete(module->name), module->name = 0);
1140 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Delete(&defines, module);
1141 }
1142 }
1143 if(!GetEcereImported() && !GetBuildingEcereCom())
1144 __ecereNameSpace__ecere__com__eModule_LoadStrict(privateModule, "ecereCOM", 1);
1145 }
1146 ParseEc();
1147 CheckDataRedefinitions();
1148 SetYydebug(0x0);
1149 SetCurrentNameSpace((((void *)0)));
1150 SetDefaultNameSpace((((void *)0)));
1151 SetDeclMode(2);
1152 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
1153 SetFileInput((((void *)0)));
1154 ast = GetAST();
1155 if(!exitCode)
1156 {
1157 ProcessDBTableDefinitions();
1158 PrePreProcessClassDefinitions();
1159 ComputeModuleClasses(privateModule);
1160 PreProcessClassDefinitions();
1161 ComputeModuleClasses(privateModule);
1162 ProcessClassDefinitions();
1163 ComputeDataTypes();
1164 ProcessInstantiations();
1165 ProcessMemberAccess();
1166 ProcessInstanceDeclarations();
1167 strcpy(impFile, GetSymbolsDir());
1168 {
1169 char fileName[274];
1170
1171 __ecereNameSpace__ecere__sys__GetLastDirectory(GetSourceFile(), fileName);
1172 __ecereNameSpace__ecere__sys__PathCat(impFile, fileName);
1173 __ecereNameSpace__ecere__sys__ChangeExtension(impFile, "imp", impFile);
1174 }
1175 if(imports.first)
1176 OutputImports(impFile);
1177 if(!((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->exitCode)
1178 {
1179 struct __ecereNameSpace__ecere__com__Instance * output = __ecereNameSpace__ecere__sys__FileOpen(GetOutputFile(), 2);
1180
1181 if(output)
1182 {
1183 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "/* Code generated from eC source file. */\n");
1184 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#if defined(__GNUC__)\n");
1185 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef long long int64;\n");
1186 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef unsigned long long uint64;\n");
1187 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#ifndef _WIN32\n");
1188 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __declspec(x)\n");
1189 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1190 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#elif defined(__TINYC__)\n");
1191 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#include <stdarg.h>\n");
1192 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __builtin_va_list va_list\n");
1193 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __builtin_va_start va_start\n");
1194 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __builtin_va_end va_end\n");
1195 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#ifdef _WIN32\n");
1196 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define strcasecmp stricmp\n");
1197 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define strncasecmp strnicmp\n");
1198 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __declspec(x) __attribute__((x))\n");
1199 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1200 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __declspec(x)\n");
1201 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1202 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef long long int64;\n");
1203 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef unsigned long long uint64;\n");
1204 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1205 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef __int64 int64;\n");
1206 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef unsigned __int64 uint64;\n");
1207 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1208 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#ifdef __BIG_ENDIAN__\n");
1209 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __ENDIAN_PAD(x) (8 - (x))\n");
1210 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1211 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __ENDIAN_PAD(x) 0\n");
1212 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1213 if(buildingBootStrap)
1214 {
1215 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#include <stdint.h>\n");
1216 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#include <sys/types.h>\n");
1217 }
1218 if(ast)
1219 OutputTree(ast, output);
1220 (__ecereNameSpace__ecere__com__eInstance_DecRef(output), output = 0);
1221 }
1222 }
1223 }
1224 else
1225 ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->exitCode = exitCode;
1226 if(ast)
1227 {
1228 FreeASTTree(ast);
1229 }
1230 }
1231 FreeContext(globalContext);
1232 FreeExcludedSymbols(&_excludedSymbols);
1233 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&defines, FreeModuleDefine);
1234 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&imports, FreeModuleImport);
1235 FreeTypeData(privateModule);
1236 FreeIncludeFiles();
1237 FreeGlobalData(&globalData);
1238 (__ecereNameSpace__ecere__com__eInstance_DecRef(privateModule), privateModule = 0);
1239 }
1240 (__ecereNameSpace__ecere__com__eSystem_Delete(cppCommand), cppCommand = 0);
1241 (__ecereNameSpace__ecere__com__eSystem_Delete(cppOptions), cppOptions = 0);
1242 SetSymbolsDir((((void *)0)));
1243 OutputIntlStrings();
1244 }
1245
1246 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);
1247
1248 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
1249
1250 struct __ecereNameSpace__ecere__com__Module
1251 {
1252 struct __ecereNameSpace__ecere__com__Instance * application;
1253 struct __ecereNameSpace__ecere__sys__OldList classes;
1254 struct __ecereNameSpace__ecere__sys__OldList defines;
1255 struct __ecereNameSpace__ecere__sys__OldList functions;
1256 struct __ecereNameSpace__ecere__sys__OldList modules;
1257 struct __ecereNameSpace__ecere__com__Instance * prev;
1258 struct __ecereNameSpace__ecere__com__Instance * next;
1259 char *  name;
1260 void *  library;
1261 void *  Unload;
1262 int importType;
1263 int origImportType;
1264 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
1265 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
1266 } __attribute__ ((gcc_struct));
1267
1268 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);
1269
1270 void __ecereRegisterModule_ecc(struct __ecereNameSpace__ecere__com__Instance * module)
1271 {
1272 struct __ecereNameSpace__ecere__com__Class * class;
1273
1274 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(0, "CompilerApp", "ecere::com::Application", 0, 0, 0, 0, module, 2, 1);
1275 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
1276 __ecereClass_CompilerApp = class;
1277 __ecereNameSpace__ecere__com__eClass_AddMethod(class, "Main", 0, __ecereMethod_CompilerApp_Main, 1);
1278 }
1279
1280 void __ecereUnregisterModule_ecc(struct __ecereNameSpace__ecere__com__Instance * module)
1281 {
1282
1283 }
1284
1285 int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_CompareString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  a, char *  b);
1286
1287 void __ecereCreateModuleInstances_ecc()
1288 {
1289 globalContext = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
1290 (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);
1291 }
1292
1293 void __ecereDestroyModuleInstances_ecc()
1294 {
1295 ((globalContext ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(globalContext) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(globalContext)) : 0), globalContext = 0);
1296 }
1297