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