ecs; ide/Project: (#1063) Fixed Windows build issues with ecs overflowing command...
[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 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__DualPipe;
853
854 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
855
856 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
857
858 int __ecereMethod___ecereNameSpace__ecere__sys__DualPipe_GetExitCode();
859
860 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
861
862 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Delete(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
863
864 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
865
866 void __ecereMethod_CompilerApp_Main(struct __ecereNameSpace__ecere__com__Instance * this)
867 {
868 char * cppCommand = (((void *)0));
869 char * cppOptions = (((void *)0));
870 int cppOptionsLen = 0;
871 int c;
872 unsigned int valid = 0x1;
873 char defaultOutputFile[797];
874 unsigned int buildingBootStrap = 0x0;
875 int targetPlatform = __ecereNameSpace__ecere__com__GetRuntimePlatform();
876 int targetBits = GetHostBits();
877
878 SetSymbolsDir("");
879 for(c = 1; c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc; c++)
880 {
881 char * arg = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c];
882
883 if(arg[0] == '-')
884 {
885 if(!strcmp(arg + 1, "m32") || !strcmp(arg + 1, "m64"))
886 {
887 int newLen = cppOptionsLen + 1 + strlen(arg);
888
889 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (newLen + 1));
890 cppOptions[cppOptionsLen] = ' ';
891 strcpy(cppOptions + cppOptionsLen + 1, arg);
892 cppOptionsLen = newLen;
893 targetBits = !strcmp(arg + 1, "m32") ? 32 : 64;
894 }
895 else if(!strcmp(arg + 1, "t32") || !strcmp(arg + 1, "t64"))
896 {
897 targetBits = !strcmp(arg + 1, "t32") ? 32 : 64;
898 }
899 else if(arg[1] == 'D' || arg[1] == 'I')
900 {
901 char * buf;
902 int size = cppOptionsLen + 1 + strlen(arg) * 2 + 1;
903
904 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
905 buf = cppOptions + cppOptionsLen;
906 *buf++ = ' ';
907 PassArg(buf, arg);
908 cppOptionsLen = cppOptionsLen + 1 + strlen(buf);
909 if(arg[1] == 'D')
910 {
911 if(!strcmp(arg, "-DBUILDING_ECERE_COM"))
912 SetBuildingEcereCom(0x1);
913 else if(!strcmp(arg, "-DECERE_COM_MODULE"))
914 SetBuildingEcereComModule(0x1);
915 else if(!strcmp(arg, "-DECERE_BOOTSTRAP"))
916 buildingBootStrap = 0x1;
917 }
918 }
919 else if(!strcmp(arg + 1, "t"))
920 {
921 if(++c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
922 targetPlatform = __ecereProp___ecereNameSpace__ecere__com__Platform_Set_char__PTR_(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c]);
923 else
924 valid = 0x0;
925 }
926 else if(!strcmp(arg + 1, "cpp"))
927 {
928 if(++c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
929 cppCommand = __ecereNameSpace__ecere__sys__CopyString(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c]);
930 else
931 valid = 0x0;
932 }
933 else if(!strcmp(arg + 1, "o"))
934 {
935 if(!GetOutputFile() && c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
936 {
937 SetOutputFile(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
938 c++;
939 }
940 else
941 valid = 0x0;
942 }
943 else if(!strcmp(arg + 1, "c"))
944 {
945 if(!GetSourceFile() && c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
946 {
947 SetSourceFile(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
948 c++;
949 }
950 else
951 valid = 0x0;
952 }
953 else if(!strcmp(arg + 1, "isystem") || !strcmp(arg + 1, "isysroot"))
954 {
955 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
956 {
957 char * buf;
958 char * arg1 = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[++c];
959 int size = cppOptionsLen + 1 + strlen(arg) * 2 + strlen(arg1) * 2 + 1;
960
961 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
962 buf = cppOptions + cppOptionsLen;
963 *buf++ = ' ';
964 buf = PassArg(buf, arg);
965 *buf++ = ' ';
966 buf = PassArg(buf, arg1);
967 cppOptionsLen = buf - cppOptions;
968 }
969 else
970 valid = 0x0;
971 }
972 else if(!strcmp(arg + 1, "fno-diagnostics-show-caret"))
973 {
974 char * buf;
975 int size = cppOptionsLen + 1 + strlen(arg) * 2 + 1;
976
977 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
978 buf = cppOptions + cppOptionsLen;
979 *buf++ = ' ';
980 PassArg(buf, arg);
981 cppOptionsLen = cppOptionsLen + 1 + strlen(buf);
982 }
983 else if(!strcmp(arg + 1, "symbols"))
984 {
985 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
986 {
987 SetSymbolsDir(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
988 c++;
989 }
990 else
991 valid = 0x0;
992 }
993 else if(!strcmp(arg + 1, "memguard"))
994 {
995 SetMemoryGuard(0x1);
996 }
997 else if(!strcmp(arg + 1, "defaultns"))
998 {
999 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
1000 {
1001 SetDefaultNameSpace(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
1002 c++;
1003 }
1004 else
1005 valid = 0x0;
1006 }
1007 else if(!strcmp(arg + 1, "strictns"))
1008 {
1009 SetStrictNameSpaces(0x1);
1010 }
1011 else if(!strcmp(arg + 1, "nolinenumbers"))
1012 {
1013 SetOutputLineNumbers(0x0);
1014 }
1015 }
1016 else
1017 valid = 0x0;
1018 }
1019 if(valid)
1020 {
1021 if(!cppCommand)
1022 cppCommand = __ecereNameSpace__ecere__sys__CopyString("gcc");
1023 if(!GetSourceFile())
1024 valid = 0x0;
1025 else if(!GetOutputFile())
1026 {
1027 strcpy(defaultOutputFile, "");
1028 __ecereNameSpace__ecere__sys__PathCat(defaultOutputFile, GetSourceFile());
1029 __ecereNameSpace__ecere__sys__ChangeExtension(defaultOutputFile, "c", defaultOutputFile);
1030 SetOutputFile(defaultOutputFile);
1031 }
1032 }
1033 if(!valid)
1034 {
1035 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))));
1036 }
1037 else
1038 {
1039 struct __ecereNameSpace__ecere__com__Instance * cppOutput;
1040 char command[3075LL];
1041
1042 SetGlobalData(&globalData);
1043 SetExcludedSymbols(&_excludedSymbols);
1044 SetGlobalContext(globalContext);
1045 SetCurrentContext(globalContext);
1046 SetTopContext(globalContext);
1047 SetDefines(&defines);
1048 SetImports(&imports);
1049 SetInCompiler(0x1);
1050 SetTargetPlatform(targetPlatform);
1051 SetTargetBits(targetBits);
1052 SetEchoOn(0x0);
1053 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)));
1054 SetPrivateModule(privateModule);
1055 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1056 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1057
1058 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint"), __ecereInstance1->type = ProcessTypeString("unsigned int", 0x0), __ecereInstance1;
1059 }));
1060 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1061 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1062
1063 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uint64"), __ecereInstance1->type = ProcessTypeString("unsigned int64", 0x0), __ecereInstance1;
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("uint32"), __ecereInstance1->type = ProcessTypeString("unsigned int", 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("uint16"), __ecereInstance1->type = ProcessTypeString("unsigned short", 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("byte"), __ecereInstance1->type = ProcessTypeString("unsigned char", 0x0), __ecereInstance1;
1079 }));
1080 if(buildingBootStrap)
1081 {
1082 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1083 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1084
1085 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("intptr_t"), __ecereInstance1->type = ProcessTypeString("intptr", 0x0), __ecereInstance1;
1086 }));
1087 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1088 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1089
1090 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("uintptr_t"), __ecereInstance1->type = ProcessTypeString("uintptr", 0x0), __ecereInstance1;
1091 }));
1092 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1093 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1094
1095 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("ssize_t"), __ecereInstance1->type = ProcessTypeString("intsize", 0x0), __ecereInstance1;
1096 }));
1097 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->types, (struct __ecereNameSpace__ecere__sys__BTNode *)__extension__ ({
1098 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
1099
1100 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("size_t"), __ecereInstance1->type = ProcessTypeString("uintsize", 0x0), __ecereInstance1;
1101 }));
1102 }
1103 {
1104 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);
1105
1106 data->key = (uintptr_t)data->fullName;
1107 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalData.functions, (struct __ecereNameSpace__ecere__sys__BTNode *)data);
1108 }
1109 snprintf(command, sizeof command, "%s%s -x c -E %s\"%s\"", cppCommand, cppOptions ? cppOptions : "", buildingBootStrap ? "" : "-include stdint.h -include sys/types.h ", GetSourceFile());
1110 command[sizeof command - 1] = (char)0;
1111 if((cppOutput = __ecereNameSpace__ecere__sys__DualPipeOpen((((unsigned int)(0x1))), command)))
1112 {
1113 char impFile[797];
1114 struct ImportedModule * module;
1115 char sourceFileName[274];
1116 char mainModuleName[274];
1117 int exitCode;
1118 struct __ecereNameSpace__ecere__sys__OldList * ast;
1119 struct __ecereNameSpace__ecere__com__Instance * fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1120
1121 SetFileInput(fileInput);
1122 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&imports, (mainModule = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ModuleImport)));
1123 SetMainModule(mainModule);
1124 __ecereNameSpace__ecere__sys__GetLastDirectory(GetSourceFile(), sourceFileName);
1125 strcpy(mainModuleName, sourceFileName);
1126 __ecereNameSpace__ecere__sys__StripExtension(mainModuleName);
1127 module = __extension__ ({
1128 struct ImportedModule * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ImportedModule);
1129
1130 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(mainModuleName), __ecereInstance1->type = 0, __ecereInstance1;
1131 });
1132 __ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&defines, module);
1133 resetScanner();
1134 while(!((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *))__extension__ ({
1135 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = cppOutput;
1136
1137 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__DualPipe->_vTbl;
1138 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Eof])(cppOutput))
1139 {
1140 char junk[4096];
1141 int count = ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
1142 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = cppOutput;
1143
1144 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__DualPipe->_vTbl;
1145 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(cppOutput, junk, 1, 4096);
1146
1147 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
1148 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
1149
1150 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1151 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, junk, 1, count);
1152 }
1153 exitCode = __ecereMethod___ecereNameSpace__ecere__sys__DualPipe_GetExitCode(cppOutput);
1154 (__ecereNameSpace__ecere__com__eInstance_DecRef(cppOutput), cppOutput = 0);
1155 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
1156 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
1157
1158 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1159 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
1160 {
1161 char symFile[274];
1162 char symLocation[797];
1163 struct ImportedModule * module, * next;
1164
1165 strcpy(symFile, sourceFileName);
1166 __ecereNameSpace__ecere__sys__ChangeExtension(symFile, "sym", symFile);
1167 strcpy(symLocation, GetSymbolsDir());
1168 __ecereNameSpace__ecere__sys__PathCat(symLocation, symFile);
1169 LoadSymbols(symLocation, 3, 0x0);
1170 for(module = defines.first; module; module = next)
1171 {
1172 next = module->next;
1173 if(module->type == 0 && (strcasecmp)(module->name, mainModuleName))
1174 {
1175 (__ecereNameSpace__ecere__com__eSystem_Delete(module->name), module->name = 0);
1176 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Delete(&defines, module);
1177 }
1178 }
1179 if(!GetEcereImported() && !GetBuildingEcereCom())
1180 __ecereNameSpace__ecere__com__eModule_LoadStrict(privateModule, "ecereCOM", 1);
1181 }
1182 ParseEc();
1183 CheckDataRedefinitions();
1184 SetYydebug(0x0);
1185 SetCurrentNameSpace((((void *)0)));
1186 SetDefaultNameSpace((((void *)0)));
1187 SetDeclMode(2);
1188 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
1189 SetFileInput((((void *)0)));
1190 ast = GetAST();
1191 if(!exitCode)
1192 {
1193 ProcessDBTableDefinitions();
1194 PrePreProcessClassDefinitions();
1195 ComputeModuleClasses(privateModule);
1196 PreProcessClassDefinitions();
1197 ComputeModuleClasses(privateModule);
1198 ProcessClassDefinitions();
1199 ComputeDataTypes();
1200 ProcessInstantiations();
1201 ProcessMemberAccess();
1202 ProcessInstanceDeclarations();
1203 strcpy(impFile, GetSymbolsDir());
1204 __ecereNameSpace__ecere__sys__PathCat(impFile, sourceFileName);
1205 __ecereNameSpace__ecere__sys__ChangeExtension(impFile, "imp", impFile);
1206 if(imports.first)
1207 OutputImports(impFile);
1208 if(!((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->exitCode)
1209 {
1210 struct __ecereNameSpace__ecere__com__Instance * output = __ecereNameSpace__ecere__sys__FileOpen(GetOutputFile(), 2);
1211
1212 if(output)
1213 {
1214 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "/* Code generated from eC source file: %s */\n", sourceFileName);
1215 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#if defined(__GNUC__)\n");
1216 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef long long int64;\n");
1217 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef unsigned long long uint64;\n");
1218 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#ifndef _WIN32\n");
1219 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __declspec(x)\n");
1220 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1221 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#elif defined(__TINYC__)\n");
1222 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#include <stdarg.h>\n");
1223 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __builtin_va_list va_list\n");
1224 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __builtin_va_start va_start\n");
1225 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __builtin_va_end va_end\n");
1226 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#ifdef _WIN32\n");
1227 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define strcasecmp stricmp\n");
1228 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define strncasecmp strnicmp\n");
1229 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __declspec(x) __attribute__((x))\n");
1230 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1231 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __declspec(x)\n");
1232 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1233 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef long long int64;\n");
1234 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef unsigned long long uint64;\n");
1235 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1236 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef __int64 int64;\n");
1237 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "typedef unsigned __int64 uint64;\n");
1238 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1239 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#ifdef __BIG_ENDIAN__\n");
1240 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __ENDIAN_PAD(x) (8 - (x))\n");
1241 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#else\n");
1242 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#define __ENDIAN_PAD(x) 0\n");
1243 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#endif\n");
1244 if(buildingBootStrap)
1245 {
1246 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#include <stdint.h>\n");
1247 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(output, "#include <sys/types.h>\n");
1248 }
1249 if(ast)
1250 OutputTree(ast, output);
1251 (__ecereNameSpace__ecere__com__eInstance_DecRef(output), output = 0);
1252 }
1253 }
1254 }
1255 else
1256 ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->exitCode = exitCode;
1257 if(ast)
1258 {
1259 FreeASTTree(ast);
1260 }
1261 }
1262 FreeContext(globalContext);
1263 FreeExcludedSymbols(&_excludedSymbols);
1264 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&defines, FreeModuleDefine);
1265 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&imports, FreeModuleImport);
1266 FreeTypeData(privateModule);
1267 FreeIncludeFiles();
1268 FreeGlobalData(&globalData);
1269 (__ecereNameSpace__ecere__com__eInstance_DecRef(privateModule), privateModule = 0);
1270 }
1271 (__ecereNameSpace__ecere__com__eSystem_Delete(cppCommand), cppCommand = 0);
1272 (__ecereNameSpace__ecere__com__eSystem_Delete(cppOptions), cppOptions = 0);
1273 SetSymbolsDir((((void *)0)));
1274 OutputIntlStrings();
1275 }
1276
1277 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);
1278
1279 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
1280
1281 struct __ecereNameSpace__ecere__com__Module
1282 {
1283 struct __ecereNameSpace__ecere__com__Instance * application;
1284 struct __ecereNameSpace__ecere__sys__OldList classes;
1285 struct __ecereNameSpace__ecere__sys__OldList defines;
1286 struct __ecereNameSpace__ecere__sys__OldList functions;
1287 struct __ecereNameSpace__ecere__sys__OldList modules;
1288 struct __ecereNameSpace__ecere__com__Instance * prev;
1289 struct __ecereNameSpace__ecere__com__Instance * next;
1290 char *  name;
1291 void *  library;
1292 void *  Unload;
1293 int importType;
1294 int origImportType;
1295 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
1296 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
1297 } __attribute__ ((gcc_struct));
1298
1299 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);
1300
1301 void __ecereRegisterModule_ecc(struct __ecereNameSpace__ecere__com__Instance * module)
1302 {
1303 struct __ecereNameSpace__ecere__com__Class * class;
1304
1305 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(0, "CompilerApp", "ecere::com::Application", 0, 0, 0, 0, module, 2, 1);
1306 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
1307 __ecereClass_CompilerApp = class;
1308 __ecereNameSpace__ecere__com__eClass_AddMethod(class, "Main", 0, __ecereMethod_CompilerApp_Main, 1);
1309 }
1310
1311 void __ecereUnregisterModule_ecc(struct __ecereNameSpace__ecere__com__Instance * module)
1312 {
1313
1314 }
1315
1316 int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_CompareString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  a, char *  b);
1317
1318 void __ecereCreateModuleInstances_ecc()
1319 {
1320 globalContext = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
1321 (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);
1322 }
1323
1324 void __ecereDestroyModuleInstances_ecc()
1325 {
1326 ((globalContext ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(globalContext) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(globalContext)) : 0), globalContext = 0);
1327 }
1328