#if defined(__GNUC__) 
typedef long long int64;
typedef unsigned long long uint64;
#else
typedef __int64 int64;
typedef unsigned __int64 uint64;
#endif
#ifdef __BIG_ENDIAN__
#define __ENDIAN_PAD(x) (8 - (x))
#else
#define __ENDIAN_PAD(x) 0
#endif
extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;

struct __ecereNameSpace__ecere__sys__BTNode;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;

struct __ecereNameSpace__ecere__sys__BinaryTree
{
struct __ecereNameSpace__ecere__sys__BTNode * root;
int count;
int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, unsigned int a, unsigned int b);
void (*  FreeKey)(void *  key);
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;

struct __ecereNameSpace__ecere__sys__OldList
{
void *  first;
void *  last;
int count;
unsigned int offset;
unsigned int circ;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;

struct __ecereNameSpace__ecere__com__Method
{
char *  name;
struct __ecereNameSpace__ecere__com__Method * parent;
struct __ecereNameSpace__ecere__com__Method * left;
struct __ecereNameSpace__ecere__com__Method * right;
int depth;
int (*  function)();
int vid;
int type;
struct __ecereNameSpace__ecere__com__Class * _class;
void *  symbol;
char *  dataTypeString;
struct Type * dataType;
int memberAccess;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;

struct __ecereNameSpace__ecere__com__Property
{
struct __ecereNameSpace__ecere__com__Property * prev;
struct __ecereNameSpace__ecere__com__Property * next;
char *  name;
unsigned int isProperty;
int memberAccess;
int id;
struct __ecereNameSpace__ecere__com__Class * _class;
char *  dataTypeString;
struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
struct Type * dataType;
void (*  Set)();
int (*  Get)();
unsigned int (*  IsSet)();
void *  data;
void *  symbol;
int vid;
unsigned int conversion;
unsigned int watcherOffset;
char *  category;
unsigned int compiled;
unsigned int selfWatchable;
unsigned int isWatchable;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;

struct CodePosition
{
int line;
int charPos;
int pos;
unsigned int included;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;

struct Location
{
struct CodePosition start;
struct CodePosition end;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;

struct ClassDefinition;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;

struct Context;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;

struct Instantiation;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;

struct Declaration;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;

struct Statement;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;

struct TypeName;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;

struct Initializer;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;

struct __ecereNameSpace__ecere__com__DataValue
{
union
{
char c;
unsigned char uc;
short s;
unsigned short us;
int i;
unsigned int ui;
void *  p;
float f;
double d;
long long i64;
uint64 ui64;
};
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;

struct Expression;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;

struct TemplateDatatype;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;

struct TemplateArgument;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;

struct TemplateParameter;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;

struct Specifier;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;

struct Identifier;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;

struct Declarator;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;

struct FunctionDefinition;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;

struct DBTableDef;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;

struct External;

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;

struct ModuleImport
{
struct ModuleImport * prev;
struct ModuleImport * next;
char *  name;
struct __ecereNameSpace__ecere__sys__OldList classes;
struct __ecereNameSpace__ecere__sys__OldList functions;
int importType;
int importAccess;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;

struct ClassImport
{
struct ClassImport * prev;
struct ClassImport * next;
char *  name;
struct __ecereNameSpace__ecere__sys__OldList methods;
struct __ecereNameSpace__ecere__sys__OldList properties;
unsigned int itself;
unsigned int isRemote;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;

struct Symbol
{
char *  string;
struct Symbol * parent;
struct Symbol * left;
struct Symbol * right;
int depth;
struct Type * type;
union
{
struct __ecereNameSpace__ecere__com__Method * method;
struct __ecereNameSpace__ecere__com__Property * _property;
struct __ecereNameSpace__ecere__com__Class * registered;
};
int id;
int idCode;
union
{
struct
{
struct External * pointerExternal;
struct External * structExternal;
};
struct
{
struct External * externalGet;
struct External * externalSet;
struct External * externalPtr;
struct External * externalIsSet;
};
struct
{
struct External * methodExternal;
struct External * methodCodeExternal;
};
};
unsigned int imported;
unsigned int declaredStructSym;
struct __ecereNameSpace__ecere__com__Class * _class;
unsigned int declaredStruct;
unsigned int needConstructor;
unsigned int needDestructor;
char *  constructorName;
char *  structName;
char *  className;
char *  destructorName;
struct ModuleImport * module;
struct ClassImport * _import;
struct Location nameLoc;
unsigned int isParam;
unsigned int isRemote;
unsigned int isStruct;
unsigned int fireWatchersDone;
int declaring;
unsigned int classData;
unsigned int isStatic;
char *  shortName;
struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
struct Context * ctx;
int isIterator;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;

struct Type
{
struct Type * prev;
struct Type * next;
int refCount;
union
{
struct Symbol * _class;
struct
{
struct __ecereNameSpace__ecere__sys__OldList members;
char *  enumName;
};
struct
{
struct Type * returnType;
struct __ecereNameSpace__ecere__sys__OldList params;
struct Symbol * thisClass;
unsigned int staticMethod;
};
struct
{
struct __ecereNameSpace__ecere__com__Method * method;
struct __ecereNameSpace__ecere__com__Class * methodClass;
struct __ecereNameSpace__ecere__com__Class * usedClass;
};
struct
{
struct Type * arrayType;
int arraySize;
struct Expression * arraySizeExp;
unsigned int freeExp;
struct Symbol * enumClass;
};
struct Type * type;
struct TemplateParameter * templateParameter;
};
unsigned int isSigned;
int kind;
unsigned int constant;
unsigned int size;
char *  name;
char *  typeName;
unsigned int count;
unsigned int truth;
int classObjectType;
unsigned int byReference;
unsigned int extraParam;
int alignment;
unsigned int directClassAccess;
unsigned int computing;
unsigned int dllExport;
unsigned int offset;
unsigned int keepCast;
unsigned int passAsTemplate;
int bitFieldCount;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;

struct __ecereNameSpace__ecere__com__Class
{
struct __ecereNameSpace__ecere__com__Class * prev;
struct __ecereNameSpace__ecere__com__Class * next;
char *  name;
int offset;
int size;
int (* *  _vTbl)();
int vTblSize;
int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
int offsetClass;
int sizeClass;
struct __ecereNameSpace__ecere__com__Class * base;
struct __ecereNameSpace__ecere__sys__BinaryTree methods;
struct __ecereNameSpace__ecere__sys__BinaryTree members;
struct __ecereNameSpace__ecere__sys__BinaryTree prop;
struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
struct __ecereNameSpace__ecere__sys__OldList derivatives;
int memberID;
int startMemberID;
int type;
struct __ecereNameSpace__ecere__com__Instance * module;
struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
char *  dataTypeString;
struct Type * dataType;
int defaultAlignment;
void (*  Initialize)();
int memberOffset;
struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
char *  designerClass;
unsigned int noExpansion;
char *  defaultProperty;
unsigned int comRedefinition;
int count;
unsigned int isRemote;
unsigned int internalDecl;
void *  data;
unsigned int computeSize;
int structAlignment;
int destructionWatchOffset;
unsigned int fixed;
struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
int inheritanceAccess;
char *  fullName;
void *  symbol;
struct __ecereNameSpace__ecere__sys__OldList conversions;
struct __ecereNameSpace__ecere__sys__OldList templateParams;
struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
struct __ecereNameSpace__ecere__com__Class * templateClass;
struct __ecereNameSpace__ecere__sys__OldList templatized;
int numParams;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;

struct __ecereNameSpace__ecere__com__Instance
{
int (* *  _vTbl)();
struct __ecereNameSpace__ecere__com__Class * _class;
int _refCount;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;

struct __ecereNameSpace__ecere__com__DataMember
{
struct __ecereNameSpace__ecere__com__DataMember * prev;
struct __ecereNameSpace__ecere__com__DataMember * next;
char *  name;
unsigned int isProperty;
int memberAccess;
int id;
struct __ecereNameSpace__ecere__com__Class * _class;
char *  dataTypeString;
struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
struct Type * dataType;
int type;
int offset;
int memberID;
struct __ecereNameSpace__ecere__sys__OldList members;
struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
int memberOffset;
int structAlignment;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;

struct __ecereNameSpace__ecere__com__SerialBuffer
{
unsigned char *  buffer;
unsigned int count;
unsigned int size;
unsigned int pos;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;

struct __ecereNameSpace__ecere__com__ClassTemplateArgument
{
union
{
struct
{
char *  dataTypeString;
struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
};
struct __ecereNameSpace__ecere__com__DataValue expression;
struct
{
char *  memberString;
union
{
struct __ecereNameSpace__ecere__com__DataMember * member;
struct __ecereNameSpace__ecere__com__Property * prop;
struct __ecereNameSpace__ecere__com__Method * method;
};
};
};
};

static int targetPlatform;

static unsigned int isConsole;

static unsigned int isDynamicLibrary;

static unsigned int isStaticLibrary;

static struct __ecereNameSpace__ecere__sys__OldList modules;

static struct __ecereNameSpace__ecere__com__Instance * dcomSymbols;

struct __ecereNameSpace__ecere__sys__OldList _defines = 
{
0, 0, 0, 0, 0
};

struct __ecereNameSpace__ecere__sys__OldList _imports = 
{
0, 0, 0, 0, 0
};

struct __ecereNameSpace__ecere__sys__OldList _excludedSymbols = 
{
0, 0, 0, (unsigned int)&((struct Symbol *)(void *)0)->left, 0
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;

struct __ecereNameSpace__ecere__com__NameSpace
{
char *  name;
struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
struct __ecereNameSpace__ecere__com__NameSpace *  left;
struct __ecereNameSpace__ecere__com__NameSpace *  right;
int depth;
struct __ecereNameSpace__ecere__com__NameSpace *  parent;
struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
struct __ecereNameSpace__ecere__sys__BinaryTree classes;
struct __ecereNameSpace__ecere__sys__BinaryTree defines;
struct __ecereNameSpace__ecere__sys__BinaryTree functions;
};

static struct __ecereNameSpace__ecere__com__NameSpace globalData;

static struct Context * theGlobalContext;

static struct ModuleImport * mainModule;

static struct __ecereNameSpace__ecere__com__Instance * privateModule;

static char mainModuleName[797];

static char projectName[797];

extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__sys__FileOpen(char *  fileName, int mode);

extern char *  __ecereNameSpace__ecere__sys__TrimLSpaces(char *  string, char *  output);

extern int strcmp(const char * , const char * );

extern struct ModuleImport * GetMainModule(void);

extern void SetMainModule(struct ModuleImport * moduleImport);

extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;

struct MethodImport
{
struct MethodImport * prev;
struct MethodImport * next;
char *  name;
unsigned int isVirtual;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;

struct PropertyImport
{
struct PropertyImport * prev;
struct PropertyImport * next;
char *  name;
unsigned int isVirtual;
unsigned int hasSet;
unsigned int hasGet;
};

extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;

struct FunctionImport
{
struct FunctionImport * prev;
struct FunctionImport * next;
char *  name;
};

unsigned int __ecereMethod___ecereNameSpace__ecere__sys__File_GetLine(struct __ecereNameSpace__ecere__com__Instance * this, char *  s, int max);

unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);

void *  __ecereMethod___ecereNameSpace__ecere__sys__OldList_FindName(struct __ecereNameSpace__ecere__sys__OldList * this, char *  name, unsigned int warn);

extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);

static void LoadImports(char * fileName)
{
void * __ecereTemp1;
struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__sys__FileOpen(fileName, 1);

if(f)
{
for(; ; )
{
char line[1024];

if(!__ecereMethod___ecereNameSpace__ecere__sys__File_GetLine(f, line, sizeof line))
break;
__ecereNameSpace__ecere__sys__TrimLSpaces(line, line);
if(line[0] == '[')
{
if(!strcmp(line, "[Imported Modules]"))
{
struct ModuleImport * module = (((void *)0));

for(; ; )
{
if(!__ecereMethod___ecereNameSpace__ecere__sys__File_GetLine(f, line, sizeof line))
break;
__ecereNameSpace__ecere__sys__TrimLSpaces(line, line);
if(!strcmp(line, "."))
break;
if(line[0] == '[')
{
struct ClassImport * _class = (((void *)0));
struct FunctionImport * function = (((void *)0));

if(!strcmp(line, "[This]"))
{
if((mainModule = GetMainModule()))
module = mainModule;
else
{
mainModule = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ModuleImport);
SetMainModule(mainModule);
module = mainModule;
__ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&_imports, module);
}
}
else if(!strcmp(line, "[Static]"))
{
module->importType = 1;
}
else if(!strcmp(line, "[Remote]"))
{
module->importType = 2;
}
else if(!strcmp(line, "[Private]"))
{
if(module->importAccess != 1)
module->importAccess = 2;
}
else if(!strcmp(line, "[Public]"))
{
module->importAccess = 1;
}
else if(!strcmp(line, "[Imported Classes]"))
{
for(; ; )
{
if(!__ecereMethod___ecereNameSpace__ecere__sys__File_GetLine(f, line, sizeof line))
break;
__ecereNameSpace__ecere__sys__TrimLSpaces(line, line);
if(!strcmp(line, "."))
break;
if(line[0] == '[')
{
if(!strcmp(line, "[Instantiated]"))
{
_class->itself = 0x1;
}
else if(!strcmp(line, "[Remote]"))
{
_class->isRemote = (unsigned int)1;
}
else if(!strcmp(line, "[Imported Methods]"))
{
struct MethodImport * method = (((void *)0));

for(; ; )
{
if(!__ecereMethod___ecereNameSpace__ecere__sys__File_GetLine(f, line, sizeof line))
break;
__ecereNameSpace__ecere__sys__TrimLSpaces(line, line);
if(!strcmp(line, "."))
break;
if(line[0] != '[')
{
if(!(method = __ecereMethod___ecereNameSpace__ecere__sys__OldList_FindName(&_class->methods, line, 0x0)))
{
method = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport), ((struct MethodImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(line), ((struct MethodImport *)__ecereTemp1));
__ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&_class->methods, method);
}
}
else if(!strcmp(line, "[Virtual]"))
method->isVirtual = 0x1;
}
}
else if(!strcmp(line, "[Imported Properties]"))
{
struct PropertyImport * prop = (((void *)0));

for(; ; )
{
if(!__ecereMethod___ecereNameSpace__ecere__sys__File_GetLine(f, line, sizeof line))
break;
__ecereNameSpace__ecere__sys__TrimLSpaces(line, line);
if(!strcmp(line, "."))
break;
if(line[0] != '[')
{
if(!(prop = __ecereMethod___ecereNameSpace__ecere__sys__OldList_FindName(&_class->properties, line, 0x0)))
{
prop = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport), ((struct PropertyImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(line), ((struct PropertyImport *)__ecereTemp1));
__ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&_class->properties, prop);
}
}
else if(!strcmp(line, "[Set]"))
prop->hasSet = 0x1;
else if(!strcmp(line, "[Get]"))
prop->hasGet = 0x1;
else if(!strcmp(line, "[Virtual]"))
prop->isVirtual = 0x1;
}
}
}
else
{
if(!(_class = __ecereMethod___ecereNameSpace__ecere__sys__OldList_FindName(&module->classes, line, 0x0)))
{
_class = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(line), ((struct ClassImport *)__ecereTemp1));
__ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&module->classes, _class);
}
}
}
}
else if(!strcmp(line, "[Imported Functions]"))
{
for(; ; )
{
if(!__ecereMethod___ecereNameSpace__ecere__sys__File_GetLine(f, line, sizeof line))
break;
__ecereNameSpace__ecere__sys__TrimLSpaces(line, line);
if(!strcmp(line, "."))
break;
if(line[0] == '[')
{
}
else
{
if(!(function = __ecereMethod___ecereNameSpace__ecere__sys__OldList_FindName(&module->functions, line, 0x0)))
{
function = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport), ((struct FunctionImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(line), ((struct FunctionImport *)__ecereTemp1));
__ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&module->functions, function);
}
}
}
}
}
else
{
if(!(module = __ecereMethod___ecereNameSpace__ecere__sys__OldList_FindName(&_imports, line, 0x0)))
{
if(!strcmp(line, "ecereCOM"))
{
module = __ecereMethod___ecereNameSpace__ecere__sys__OldList_FindName(&_imports, "ecere", 0x0);
}
else if(!strcmp(line, "ecere"))
{
module = __ecereMethod___ecereNameSpace__ecere__sys__OldList_FindName(&_imports, "ecereCOM", 0x0);
if(module)
{
(__ecereNameSpace__ecere__com__eSystem_Delete(module->name), module->name = 0);
module->name = __ecereNameSpace__ecere__sys__CopyString("ecere");
}
}
if(!module)
{
module = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ModuleImport), ((struct ModuleImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(line), ((struct ModuleImport *)__ecereTemp1));
__ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&_imports, module);
}
}
}
}
}
}
}
(__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
}
}

static struct __ecereNameSpace__ecere__com__Class * thisAppClass;

struct ModuleInfo
{
struct ModuleInfo * prev, * next;
char * name;
unsigned int globalInstance;
};

static struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleInfo;

extern char *  __ecereNameSpace__ecere__sys__GetLastDirectory(char *  string, char *  output);

extern unsigned int __ecereNameSpace__ecere__sys__StripExtension(char *  string);

extern char *  strcpy(char * , const char * );

extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ImportedModule;

struct ImportedModule
{
struct ImportedModule * prev;
struct ImportedModule * next;
char *  name;
int type;
int importType;
unsigned int globalInstance;
unsigned int dllOnly;
int importAccess;
};

static void BindDCOMServer();

static void BindDCOMClient();

extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);

extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);

extern void MangleClassName(char *  className);

extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_FindMethod(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module);

extern struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);

extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);

extern void FinishTemplatesContext(struct Context * context);

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;

struct __ecereNameSpace__ecere__com__GlobalFunction
{
struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
struct __ecereNameSpace__ecere__com__GlobalFunction * next;
char *  name;
int (*  function)();
struct __ecereNameSpace__ecere__com__Instance * module;
struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
char *  dataTypeString;
struct Type * dataType;
void *  symbol;
};

extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);

extern int sprintf(char * , char * , ...);

extern void __ecereNameSpace__ecere__com__eInstance_Delete(struct __ecereNameSpace__ecere__com__Instance * instance);

int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts;

int __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(struct __ecereNameSpace__ecere__com__Instance * this, char *  format, ...);

int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;

int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Eof;

int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;

int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;

static void WriteMain(char * fileName)
{
struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__sys__FileOpen(fileName, 2);

if(f)
{
struct ModuleImport * module;
struct ModuleInfo * defModule;
unsigned int nonInst = 0x0, anyMethod = 0x0, anyProp = 0x0, anyFunction = 0x0;
struct ImportedModule * importedModule;

__ecereNameSpace__ecere__sys__GetLastDirectory(fileName, mainModuleName);
__ecereNameSpace__ecere__sys__StripExtension(mainModuleName);
if(!projectName[0])
{
strcpy(projectName, mainModuleName);
__ecereNameSpace__ecere__sys__StripExtension(projectName);
}
__ecereNameSpace__ecere__sys__ChangeCh(mainModuleName, '.', '_');
__ecereNameSpace__ecere__sys__ChangeCh(mainModuleName, '-', '_');
__ecereNameSpace__ecere__sys__ChangeCh(mainModuleName, ' ', '_');
if(targetPlatform == 1 && !isConsole && !isStaticLibrary && !isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "typedef void * HINSTANCE;\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "#define WINAPI __stdcall\n");
}
for(importedModule = _defines.first; importedModule; importedModule = importedModule->next)
{
if(importedModule->type == 0)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "import ");
if(importedModule->importType == 1)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "static ", importedModule->name);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\"%s\"\n", importedModule->name);
}
}
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "default:\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "static Module __currentModule;\n\n");
if(!isStaticLibrary)
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "Module __thisModule;\n\n");
BindDCOMServer();
BindDCOMClient();
if(dcomSymbols)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "void __ecereRegisterModule_%s(Module module);\n\n", mainModuleName);
for(module = _imports.first; module; module = module->next)
{
struct ClassImport * _class;
struct FunctionImport * function;

if(module->importType == 1)
{
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "bool __ecereDll_Load_%s(Module module);\n", module->name);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "bool __ecereDll_Unload_%s(Module module);\n", module->name);
}
}
for(_class = module->classes.first; _class; _class = _class->next)
{
struct MethodImport * method;
struct PropertyImport * prop;
char className[1024] = "";
struct __ecereNameSpace__ecere__com__Class * regClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, _class->name);

FullClassNameCat(className, _class->name, 0x1);
MangleClassName(className);
if(_class->itself)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "Class __ecereClass_%s;\n", className);
else
nonInst = 0x1;
{
{
for(method = _class->methods.first; method; method = method->next)
{
struct __ecereNameSpace__ecere__com__Method * meth = __ecereNameSpace__ecere__com__eClass_FindMethod(regClass, method->name, privateModule);

if(meth && !meth->dataType)
{
struct Context * context = SetupTemplatesContext(regClass);

meth->dataType = ProcessTypeString(meth->dataTypeString, 0x0);
FinishTemplatesContext(context);
}
if(method->isVirtual)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "int __ecereVMethodID_%s_%s;\n", className, method->name);
else if(module->name && module->importType != 1 && (!meth || !meth->dataType->dllExport))
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "int (*__ecereMethod_%s_%s)();\n", className, method->name);
}
anyMethod = 0x1;
}
}
for(prop = _class->properties.first; prop; prop = prop->next)
{
char propName[1024];

propName[0] = (char)0;
FullClassNameCat(propName, prop->name, 0x1);
MangleClassName(propName);
if(module->name && module->importType != 1)
{
if(prop->hasSet)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "void * __ecereProp_%s_Set_%s;\n", className, propName);
if(prop->hasGet)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "void * __ecereProp_%s_Get_%s;\n", className, propName);
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "Property __ecereProp_%s_%s;\n", className, propName);
anyProp = 0x1;
}
}
}
for(function = module->functions.first; function; function = function->next)
{
struct __ecereNameSpace__ecere__com__GlobalFunction * func = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, function->name);

if(func && !func->dataType)
func->dataType = ProcessTypeString(func->dataTypeString, 0x0);
if(module->name && module->importType != 1 && (!func || !func->dataType || !func->dataType->dllExport))
{
char functionName[1024];

functionName[0] = (char)0;
FullClassNameCat(functionName, function->name, 0x0);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "void * __ecereFunction_%s;\n", functionName);
anyFunction = 0x1;
}
}
}
for(defModule = modules.first; defModule; defModule = defModule->next)
{
char moduleName[1024];

strcpy(moduleName, defModule->name);
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, ' ', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '-', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '.', '_');
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "void __ecereRegisterModule_%s(Module module);\n", moduleName);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "void __ecereUnregisterModule_%s(Module module);\n", moduleName);
if(defModule->globalInstance)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "void __ecereCreateModuleInstances_%s();\n", moduleName);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "void __ecereDestroyModuleInstances_%s();\n", moduleName);
}
}
if(dcomSymbols)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))dcomSymbols->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(dcomSymbols, 0, 0);
while(!((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *))dcomSymbols->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Eof])(dcomSymbols))
{
char buffer[4096];
int read = ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))dcomSymbols->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(dcomSymbols, buffer, 1, sizeof buffer);

if(!read)
break;
((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(f, buffer, 1, read);
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
if(isStaticLibrary)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\nbool __ecereDll_Load_%s(Module module)\n{\n", projectName);
}
else if(isDynamicLibrary)
{
if(targetPlatform == 1)
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "\ndllexport bool __stdcall __ecereDll_Load(Module module)\n{\n");
else
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "\ndllexport bool __ecereDll_Load(Module module)\n{\n");
}
else if(targetPlatform == 1 && !isConsole)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "\nint WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, char * cmdLine, int show)\n{\n");
}
else
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "\nint main(int _argc, char * _argv[])\n{\n");
if(!isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   int exitCode;\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   Module module;\n");
}
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   Class _class;\n");
if(anyMethod)
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   Method method;\n");
if(anyProp)
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   Property _property;\n");
if(anyFunction)
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   GlobalFunction function;\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "\n");
if(isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   if(!__currentModule)\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   {\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "      __currentModule = module;\n");
if(!isStaticLibrary)
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "      __thisModule = module;\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   }\n\n");
}
else if(targetPlatform == 1 && !isConsole)
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   __thisModule = __currentModule = module = __ecere_COM_Initialize(1, 0, null);\n\n");
else
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   __thisModule = __currentModule = module = __ecere_COM_Initialize(1, _argc, (void *)_argv);\n\n");
if(_imports.count)
{
for(module = _imports.first; module; module = module->next)
{
if(module->name)
{
{
if(module->importType == 1)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   eModule_LoadStatic(module, \"%s\", %s, __ecereDll_Load_%s, __ecereDll_Unload_%s);\n", module->name, (module->importAccess == 2) ? "privateAccess" : "publicAccess", module->name, module->name);
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   eModule_Load(module, \"%s\", %s);\n", module->name, (module->importAccess == 2) ? "privateAccess" : "publicAccess");
}
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
if(modules.count)
{
for(defModule = modules.first; defModule; defModule = defModule->next)
{
char moduleName[1024];

strcpy(moduleName, defModule->name);
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, ' ', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '-', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '.', '_');
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __ecereRegisterModule_%s(module);\n", moduleName);
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
if(dcomSymbols)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __ecereRegisterModule_%s(module);\n\n", mainModuleName);
(__ecereNameSpace__ecere__com__eInstance_DecRef(dcomSymbols), dcomSymbols = 0);
}
if(isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   if(__currentModule == module)\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   {\n");
}
for(module = _imports.first; module; module = module->next)
{
struct ClassImport * _class;
struct FunctionImport * function;

if(module->classes.count)
{
for(_class = module->classes.first; _class; _class = _class->next)
{
struct __ecereNameSpace__ecere__com__Class * regClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, _class->name);

{
struct MethodImport * method;
struct PropertyImport * prop;
char classID[1024];
char className[1024] = "";

FullClassNameCat(className, _class->name, 0x1);
MangleClassName(className);
if(_class->itself)
sprintf(classID, "__ecereClass_%s", className);
else
strcpy(classID, "_class");
if(isDynamicLibrary && !isStaticLibrary)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   %s = eSystem_FindClass(__currentModule, \"%s\");\n", classID, _class->name);
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   %s = eSystem_FindClass(module, \"%s\");\n", classID, _class->name);
for(method = _class->methods.first; method; method = method->next)
{
struct __ecereNameSpace__ecere__com__Method * meth = __ecereNameSpace__ecere__com__eClass_FindMethod(regClass, method->name, privateModule);

if(!meth || !meth->dataType->dllExport)
{
if(method->isVirtual || (module->name && module->importType != 1))
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   method = eClass_FindMethod(%s, \"%s\", module);\n", classID, method->name);
if(method->isVirtual)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   if(method) __ecereVMethodID_%s_%s = method.vid;\n", className, method->name);
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   if(method) __ecereMethod_%s_%s = method.function;\n", className, method->name);
}
}
}
for(prop = _class->properties.first; prop; prop = prop->next)
{
char propName[1024];

propName[0] = (char)0;
FullClassNameCat(propName, prop->name, 0x1);
MangleClassName(propName);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __ecereProp_%s_%s = _property = eClass_FindProperty(%s, \"%s\", module);\n", className, propName, classID, prop->name);
if(module->name && module->importType != 1)
{
if(prop->hasSet)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __ecereProp_%s_Set_%s = _property.Set;\n", className, propName);
if(prop->hasGet)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __ecereProp_%s_Get_%s = _property.Get;\n", className, propName);
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
}
}
if(module->functions.count)
{
for(function = module->functions.first; function; function = function->next)
{
struct __ecereNameSpace__ecere__com__GlobalFunction * func = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, function->name);

if(module->name && module->importType != 1 && (!func || !func->dataType || !func->dataType->dllExport))
{
char functionName[1024];

functionName[0] = (char)0;
FullClassNameCat(functionName, function->name, 0x0);
if(isDynamicLibrary && !isStaticLibrary)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   function = eSystem_FindFunction(__currentModule, \"%s\");\n", function->name);
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   function = eSystem_FindFunction(module, \"%s\");\n", function->name);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   if(function) __ecereFunction_%s = function.function;\n", functionName);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
}
if(isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   }\n");
}
if(!isDynamicLibrary && thisAppClass)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   _class = eSystem_FindClass(__currentModule, \"%s\");\n", thisAppClass->name);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   eInstance_Evolve((Instance *)&__currentModule, _class);\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __thisModule = __currentModule;\n");
}
if(isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   if(__currentModule == module)\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   {\n");
}
if(modules.count)
{
for(defModule = modules.first; defModule; defModule = defModule->next)
if(defModule->globalInstance)
{
char moduleName[1024];

strcpy(moduleName, defModule->name);
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, ' ', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '-', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '.', '_');
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __ecereCreateModuleInstances_%s();\n", moduleName);
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
if(isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   }\n");
}
if(!isDynamicLibrary && thisAppClass)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __currentModule._vTbl[12](__currentModule);\n");
}
if(isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   return true;\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "}\n");
if(isStaticLibrary)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\nbool __ecereDll_Unload_%s(Module module)\n{\n", projectName);
}
else
{
if(targetPlatform == 1)
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "\ndllexport bool __stdcall __ecereDll_Unload(Module module)\n{\n");
else
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "\ndllexport bool __ecereDll_Unload(Module module)\n{\n");
}
}
if(isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   if(__currentModule == module)\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   {\n");
}
if(modules.count)
{
for(defModule = modules.first; defModule; defModule = defModule->next)
if(defModule->globalInstance)
{
char moduleName[1024];

strcpy(moduleName, defModule->name);
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, ' ', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '-', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '.', '_');
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __ecereDestroyModuleInstances_%s();\n", moduleName);
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
if(isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   }\n");
if(isDynamicLibrary)
{
}
if(modules.count)
{
for(defModule = modules.first; defModule; defModule = defModule->next)
{
char moduleName[1024];

strcpy(moduleName, defModule->name);
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, ' ', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '-', '_');
__ecereNameSpace__ecere__sys__ChangeCh(moduleName, '.', '_');
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __ecereUnregisterModule_%s(module);\n", moduleName);
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   if(__currentModule == module)\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "      __currentModule = (void *)0;\n");
if(!isStaticLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   if(__thisModule == module)\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "      __thisModule = (void *)0;\n");
}
}
if(!isDynamicLibrary)
{
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "\n   _class = eSystem_FindClass(__currentModule, \"ecere::com::Application\");\n   exitCode = ((ecere::com::Application)__currentModule).exitCode;\n   delete __currentModule;\n   return exitCode;\n");
}
else
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "   return true;\n");
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "}\n");
__ecereNameSpace__ecere__com__eInstance_Delete(f);
}
}

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;

struct __ecereNameSpace__ecere__com__BTNamedLink
{
char *  name;
struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
struct __ecereNameSpace__ecere__com__BTNamedLink * left;
struct __ecereNameSpace__ecere__com__BTNamedLink * right;
int depth;
void *  data;
};

struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);

extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;

struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);

extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;

static struct __ecereNameSpace__ecere__com__Class * FindAppClass(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, unsigned int thisModule)
{
struct __ecereNameSpace__ecere__com__BTNamedLink * link;
struct __ecereNameSpace__ecere__com__NameSpace * ns;

for(link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&(*nameSpace).classes); link; link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)link)))
{
struct __ecereNameSpace__ecere__com__Class * _class = link->data;

if(strcmp(_class->fullName, "ecere::com::Application") && (!thisModule || _class->module == privateModule))
{
struct __ecereNameSpace__ecere__com__Class * base;

for(base = _class->base; base && base->type != 1000; base = base->base)
if(!strcmp(base->fullName, "ecere::com::Application"))
return _class;
}
}
for(ns = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&(*nameSpace).nameSpaces); ns; ns = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)ns)))
{
struct __ecereNameSpace__ecere__com__Class * _class = FindAppClass(ns, thisModule);

if(_class)
return _class;
}
return (((void *)0));
}

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;

struct __ecereNameSpace__ecere__com__Module
{
struct __ecereNameSpace__ecere__com__Instance * application;
struct __ecereNameSpace__ecere__sys__OldList classes;
struct __ecereNameSpace__ecere__sys__OldList defines;
struct __ecereNameSpace__ecere__sys__OldList functions;
struct __ecereNameSpace__ecere__sys__OldList modules;
struct __ecereNameSpace__ecere__com__Instance * prev;
struct __ecereNameSpace__ecere__com__Instance * next;
char *  name;
void *  library;
void *  Unload;
int importType;
struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;

struct __ecereNameSpace__ecere__com__SubModule
{
struct __ecereNameSpace__ecere__com__SubModule * prev;
struct __ecereNameSpace__ecere__com__SubModule * next;
struct __ecereNameSpace__ecere__com__Instance * module;
int importMode;
};

static struct __ecereNameSpace__ecere__com__Class * SearchAppClass_Module(struct __ecereNameSpace__ecere__com__Instance * module)
{
struct __ecereNameSpace__ecere__com__Class * appClass;
struct __ecereNameSpace__ecere__com__SubModule * subModule;

appClass = FindAppClass(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->publicNameSpace, 0x0);
if(appClass)
return appClass;
appClass = FindAppClass(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->privateNameSpace, 0x0);
if(appClass)
return appClass;
for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->modules.first; subModule; subModule = subModule->next)
{
appClass = SearchAppClass_Module(subModule->module);
if(appClass)
return appClass;
}
return (((void *)0));
}

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;

struct __ecereNameSpace__ecere__sys__TempFile
{
char __ecere_padding[24];
};

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;

struct __ecereNameSpace__ecere__sys__OldLink
{
struct __ecereNameSpace__ecere__sys__OldLink * prev;
struct __ecereNameSpace__ecere__sys__OldLink * next;
void *  data;
};

extern void DeclareClass(struct Symbol * classSym, char *  className);

extern struct Symbol * FindClass(char *  name);

extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);

extern void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);

extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);

extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);

extern struct Identifier * MkIdentifier(char *  string);

extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);

extern void OutputTypeName(struct TypeName * type, struct __ecereNameSpace__ecere__com__Instance * f);

extern char *  strcat(char * , const char * );

extern void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char *  name);

static void BindDCOMClient()
{
struct __ecereNameSpace__ecere__com__Class * dcomClientObjectClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::net::DCOMClientObject");
struct __ecereNameSpace__ecere__sys__OldLink * deriv;

if(dcomClientObjectClass && dcomClientObjectClass->derivatives.first)
{
struct __ecereNameSpace__ecere__com__Instance * f;

if(!dcomSymbols)
dcomSymbols = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
f = dcomSymbols;
for(deriv = dcomClientObjectClass->derivatives.first; deriv; deriv = deriv->next)
{
struct __ecereNameSpace__ecere__com__Class * _class = deriv->data;
struct __ecereNameSpace__ecere__com__Method * method, * next;
int id = 0;
int vid;
unsigned int doVirtual;

DeclareClass(FindClass("ecere::net::DCOMClientObject"), "__ecereClass___ecereNameSpace__ecere__net__DCOMClientObject");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "class %s : ecere::net::DCOMClientObject\n", _class->fullName);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "{\n");
if(_class->vTblSize > _class->base->vTblSize)
{
int vid;

__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   virtual void CallVirtualMethod(uint __ecereMethodID, SerialBuffer __ecereBuffer)\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   {\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      switch(__ecereMethodID)\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      {\n");
for(vid = _class->base->vTblSize; vid < _class->vTblSize; vid++)
{
struct __ecereNameSpace__ecere__com__Method * method;

for(method = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&_class->methods); method; method = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)method)))
{
if(method->type == 1 && method->_class == _class && method->vid == vid)
break;
}
if(method)
{
struct Type * param;

method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
if(method->dataType && method->dataType->name)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         case %d:\n", vid - _class->base->vTblSize);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         {\n");
{
if(method->dataType->returnType->kind != 0)
{
struct TypeName * resultType;
struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
struct Declarator * decl;
char type[1024] = "";
char className[1024];
struct Symbol * classSym;

if(method->dataType->returnType->kind == 8)
classSym = method->dataType->returnType->_class;
else
{
PrintType(method->dataType->returnType, type, 0x0, 0x1);
classSym = FindClass(type);
type[0] = (char)0;
}
strcpy(className, "__ecereClass_");
FullClassNameCat(className, classSym->string, 0x1);
MangleClassName(className);
DeclareClass(classSym, className);
PrintType(method->dataType->returnType, type, 0x1, 0x1);
decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
resultType = MkTypeName(specs, decl);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
OutputTypeName(resultType, f);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n");
}
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->kind == 8 && !strcmp(param->_class->string, "String"))
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            char %s[1024];\n", param->name);
DeclareClass(FindClass("char *"), "__ecereClass_char__");
DeclareClass(FindClass("String"), "__ecereClass_String");
}
else
{
struct TypeName * paramTypeName;
struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
struct Declarator * decl;
char type[1024] = "";
char className[1024];
struct Symbol * classSym;

if(param->kind == 8)
classSym = param->_class;
else
{
PrintType(param, type, 0x0, 0x1);
classSym = FindClass(type);
type[0] = (char)0;
}
strcpy(className, "__ecereClass_");
FullClassNameCat(className, classSym->string, 0x1);
MangleClassName(className);
DeclareClass(classSym, className);
PrintType(param, type, 0x1, 0x1);
decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier(param->name)));
paramTypeName = MkTypeName(specs, decl);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
OutputTypeName(paramTypeName, f);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n");
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
for(param = method->dataType->params.first; param; param = param->next)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            __ecereBuffer.Unserialize(");
if(param->kind == 8 && !strcmp(param->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "(char *)");
}
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, param->name);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ");\n");
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
if(method->dataType->returnType->kind != 0)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "__ecereResult = ");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "%s(", method->name);
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->prev)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ", ");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "%s", param->name);
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ");\n");
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->kind == 8 && ((param->_class && param->_class->registered && param->_class->registered->type == 1) || !strcmp(param->_class->string, "String")) && !param->constant)
{
if(!strcmp(param->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            __ecereBuffer.Serialize((char *)%s);\n", param->name);
}
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            __ecereBuffer.Serialize(%s);\n", param->name);
}
}
if(method->dataType->returnType->kind != 0)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            __ecereBuffer.Serialize(__ecereResult);\n");
}
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->kind == 8 && strcmp(param->_class->string, "String") && param->_class->registered && (param->_class->registered->type == 0 || param->_class->registered->type == 5))
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            delete %s;\n", param->name);
}
}
if(method->dataType->returnType->kind == 8 && strcmp(method->dataType->returnType->_class->string, "String") && method->dataType->returnType->_class->registered && (method->dataType->returnType->_class->registered->type == 0 || method->dataType->returnType->_class->registered->type == 5))
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            delete __ecereResult;\n");
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            break;\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         }\n");
}
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      }\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   }\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
doVirtual = 0x1;
id = 0;
vid = _class->base->vTblSize;
next = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&_class->methods);
while(next && ((next->type == 1) != doVirtual || (doVirtual && next->vid != vid)))
{
id++;
next = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)next));
if(!next && doVirtual)
{
if(vid == _class->vTblSize)
doVirtual = 0x0;
else
vid++;
id = 0;
next = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&_class->methods);
}
}
for(method = next; method; method = next)
{
struct Type * param;

if(!method->dataType)
method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
if(method->dataType->name)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   ");
if(doVirtual)
{
char name[1024];

strcpy(name, "__ecereVMethodID_");
FullClassNameCat(name, method->_class->fullName, 0x1);
strcat(name, "_");
strcat(name, method->name);
DeclareMethod(method, name);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "virtual ");
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "%s\n", method->dataTypeString);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   {\n");
if(method->dataType)
{
if(method->dataType->returnType->kind != 0)
{
struct TypeName * resultType;
struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
struct Declarator * decl;
char type[1024] = "";
char className[1024];
struct Symbol * classSym;

if(method->dataType->returnType->kind == 8)
classSym = method->dataType->returnType->_class;
else
{
PrintType(method->dataType->returnType, type, 0x0, 0x1);
classSym = FindClass(type);
type[0] = (char)0;
}
strcpy(className, "__ecereClass_");
FullClassNameCat(className, classSym->string, 0x1);
MangleClassName(className);
DeclareClass(classSym, className);
PrintType(method->dataType->returnType, type, 0x1, 0x1);
decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
resultType = MkTypeName(specs, decl);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      ");
OutputTypeName(resultType, f);
if(method->dataType->returnType->kind == 9)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " = { 0 }");
else if(method->dataType->returnType->kind == 8 && method->dataType->returnType->_class->registered && method->dataType->returnType->_class->registered->type == 1)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " { }");
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " = 0");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n\n");
}
for(param = method->dataType->params.first; param; param = param->next)
{
char type[1024] = "";
char className[1024];
struct Symbol * classSym;

if(param->kind == 8)
classSym = param->_class;
else
{
PrintType(param, type, 0x0, 0x1);
classSym = FindClass(type);
type[0] = (char)0;
}
strcpy(className, "__ecereClass_");
FullClassNameCat(className, classSym->string, 0x1);
MangleClassName(className);
DeclareClass(classSym, className);
if(param->kind == 8 && !strcmp(param->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      __ecereBuffer.Serialize((char *)%s);\n", param->name);
}
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      __ecereBuffer.Serialize(%s);\n", param->name);
}
DeclareMethod(__ecereNameSpace__ecere__com__eClass_FindMethod(__ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::net::DCOMClientObject"), "CallMethod", privateModule), "__ecereMethod___ecereNameSpace__ecere__net__DCOMClientObject_CallMethod");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      if(DCOMClientObject::CallMethod(%d))\n", id++);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      {\n");
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->kind == 8 && ((param->_class && param->_class->registered && param->_class->registered->type == 1) || !strcmp(param->_class->string, "String")) && !param->constant)
{
if(!strcmp(param->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         __ecereBuffer.Unserialize((char *)%s);\n", param->name);
}
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         __ecereBuffer.Unserialize(%s);\n", param->name);
}
}
if(method->dataType->returnType->kind != 0)
{
if(method->dataType->returnType->kind == 8 && !strcmp(method->dataType->returnType->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         __ecereBuffer.Unserialize((char *)__ecereResult);\n");
}
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         __ecereBuffer.Unserialize(__ecereResult);\n");
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      }\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      __ecereBuffer.Free();\n");
if(method->dataType->returnType->kind != 0)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      return __ecereResult;\n");
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   }\n");
}
next = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)method));
while(next && ((next->type == 1) != doVirtual || (doVirtual && next->vid != vid)))
{
id++;
next = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)next));
if(!next && doVirtual)
{
if(vid == _class->vTblSize)
doVirtual = 0x0;
else
vid++;
id = 0;
next = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&_class->methods);
}
}
if(next)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "}\n");
if(deriv->next)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
}
}
}

static void BindDCOMServer()
{
struct __ecereNameSpace__ecere__com__Class * _class;

for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)privateModule + 12)))->classes.first; _class; _class = _class->next)
{
if(_class->isRemote == (unsigned int)3)
break;
}
if(_class)
{
struct __ecereNameSpace__ecere__com__Instance * f;

if(!dcomSymbols)
dcomSymbols = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
f = dcomSymbols;
DeclareClass(FindClass("ecere::net::DCOMServerObject"), "__ecereClass___ecereNameSpace__ecere__net__DCOMServerObject");
for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)privateModule + 12)))->classes.first; _class; _class = _class->next)
{
if(_class->isRemote == (unsigned int)3)
{
struct __ecereNameSpace__ecere__com__Method * method;
int id = 0;
int vid;

__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "class DCOM%s : ecere::net::DCOMServerObject\n", _class->fullName);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "{\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   virtual void CallMethod(uint __ecereMethodID, SerialBuffer __ecereBuffer)\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   {\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      switch(__ecereMethodID)\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      {\n");
for(method = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&_class->methods); method; method = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)method)))
{
struct Type * param;

method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
if(method->dataType && method->dataType->name)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         case %d:\n", id++);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         {\n");
{
if(method->dataType->returnType->kind != 0)
{
struct TypeName * resultType;
struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
struct Declarator * decl;
char type[1024] = "";
char className[1024];
struct Symbol * classSym;

if(method->dataType->returnType->kind == 8)
classSym = method->dataType->returnType->_class;
else
{
PrintType(method->dataType->returnType, type, 0x0, 0x1);
classSym = FindClass(type);
type[0] = (char)0;
}
strcpy(className, "__ecereClass_");
FullClassNameCat(className, classSym->string, 0x1);
MangleClassName(className);
DeclareClass(classSym, className);
PrintType(method->dataType->returnType, type, 0x1, 0x1);
decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
resultType = MkTypeName(specs, decl);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
OutputTypeName(resultType, f);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n");
}
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->kind == 8 && !strcmp(param->_class->string, "String"))
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            char %s[1024];\n", param->name);
DeclareClass(FindClass("char *"), "__ecereClass_char__");
DeclareClass(FindClass("String"), "__ecereClass_String");
}
else
{
struct TypeName * paramTypeName;
struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
struct Declarator * decl;
char type[1024] = "";
char className[1024];
struct Symbol * classSym;

if(param->kind == 8)
classSym = param->_class;
else
{
PrintType(param, type, 0x0, 0x1);
classSym = FindClass(type);
type[0] = (char)0;
}
strcpy(className, "__ecereClass_");
FullClassNameCat(className, classSym->string, 0x1);
MangleClassName(className);
DeclareClass(classSym, className);
PrintType(param, type, 0x1, 0x1);
decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier(param->name)));
paramTypeName = MkTypeName(specs, decl);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
OutputTypeName(paramTypeName, f);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n");
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
for(param = method->dataType->params.first; param; param = param->next)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            __ecereBuffer.Unserialize(");
if(param->kind == 8 && !strcmp(param->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "(char *)");
}
((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, param->name);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ");\n");
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
if(method->dataType->returnType->kind != 0)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "__ecereResult = ");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "((%s)instance).%s(", _class->fullName, method->name);
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->prev)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ", ");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "%s", param->name);
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ");\n");
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->kind == 8 && ((param->_class && param->_class->registered && param->_class->registered->type == 1) || !strcmp(param->_class->string, "String")) && !param->constant)
{
if(!strcmp(param->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            __ecereBuffer.Serialize((char *)%s);\n", param->name);
}
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            __ecereBuffer.Serialize(%s);\n", param->name);
}
}
if(method->dataType->returnType->kind != 0)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            __ecereBuffer.Serialize(__ecereResult);\n");
}
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->kind == 8 && strcmp(param->_class->string, "String") && param->_class->registered && (param->_class->registered->type == 0 || param->_class->registered->type == 5))
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            delete %s;\n", param->name);
}
}
if(method->dataType->returnType->kind == 8 && strcmp(method->dataType->returnType->_class->string, "String") && method->dataType->returnType->_class->registered && (method->dataType->returnType->_class->registered->type == 0 || method->dataType->returnType->_class->registered->type == 5))
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            delete __ecereResult;\n");
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            break;\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         }\n");
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      }\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   }\n");
for(vid = _class->base->vTblSize; vid < _class->vTblSize; vid++)
{
struct __ecereNameSpace__ecere__com__Method * method;
struct Type * param;

for(method = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&_class->methods); method; method = (struct __ecereNameSpace__ecere__com__Method *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)method)))
if(method->type == 1 && method->_class == _class && method->vid == vid)
break;
if(method)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n");
if(!method->dataType)
method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
if(method->dataType->name)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   virtual %s\n", method->dataTypeString);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   {\n");
if(method->dataType)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      DCOM%s __ecereObject = (void *)_vTbl[-1];\n", _class->fullName);
if(method->dataType->returnType->kind != 0)
{
struct TypeName * resultType;
struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
struct Declarator * decl;
char type[1024] = "";
char className[1024];
struct Symbol * classSym;

if(method->dataType->returnType->kind == 8)
classSym = method->dataType->returnType->_class;
else
{
PrintType(method->dataType->returnType, type, 0x0, 0x1);
classSym = FindClass(type);
type[0] = (char)0;
}
strcpy(className, "__ecereClass_");
FullClassNameCat(className, classSym->string, 0x1);
MangleClassName(className);
DeclareClass(classSym, className);
PrintType(method->dataType->returnType, type, 0x1, 0x1);
decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
resultType = MkTypeName(specs, decl);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      ");
OutputTypeName(resultType, f);
if(method->dataType->returnType->kind == 9)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " = { 0 }");
else if(method->dataType->returnType->kind == 8 && method->dataType->returnType->_class->registered && method->dataType->returnType->_class->registered->type == 1)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " { }");
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " = 0");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n\n");
}
for(param = method->dataType->params.first; param; param = param->next)
{
char type[1024] = "";
char className[1024];
struct Symbol * classSym;

if(param->kind == 8)
classSym = param->_class;
else
{
PrintType(param, type, 0x0, 0x1);
classSym = FindClass(type);
type[0] = (char)0;
}
strcpy(className, "__ecereClass_");
FullClassNameCat(className, classSym->string, 0x1);
MangleClassName(className);
DeclareClass(classSym, className);
if(param->kind == 8 && !strcmp(param->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      __ecereObject.virtualsBuffer.Serialize((char *)%s);\n", param->name);
}
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      __ecereObject.virtualsBuffer.Serialize(%s);\n", param->name);
}
DeclareMethod(__ecereNameSpace__ecere__com__eClass_FindMethod(__ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::net::DCOMServerObject"), "CallVirtualMethod", privateModule), "__ecereMethod___ecereNameSpace__ecere__net__DCOMServerObject_CallVirutalMethod");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      if(__ecereObject.CallVirtualMethod(%d))\n", vid - _class->base->vTblSize);
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      {\n");
for(param = method->dataType->params.first; param; param = param->next)
{
if(param->kind == 8 && ((param->_class && param->_class->registered && param->_class->registered->type == 1) || !strcmp(param->_class->string, "String")) && !param->constant)
{
if(!strcmp(param->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         __ecereObject.virtualsBuffer.Unserialize((char *)%s);\n", param->name);
}
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         __ecereObject.virtualsBuffer.Unserialize(%s);\n", param->name);
}
}
if(method->dataType->returnType->kind != 0)
{
if(method->dataType->returnType->kind == 8 && !strcmp(method->dataType->returnType->_class->string, "String"))
{
DeclareClass(FindClass("char *"), "__ecereClass_char__");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         __ecereObject.virtualsBuffer.Unserialize((char *)__ecereResult);\n");
}
else
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         __ecereObject.virtualsBuffer.Unserialize(__ecereResult);\n");
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      }\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      else\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "         ((%s)this).%s::%s(", _class->fullName, _class->fullName, method->name);
for(param = method->dataType->params.first; param; param = param->next)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "%s", param->name);
if(param->next)
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ", ");
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ");\n");
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      __ecereObject.virtualsBuffer.Free();\n");
if(method->dataType->returnType->kind != 0)
{
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      return __ecereResult;\n");
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   }\n");
}
}
}
__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "}\n");
}
}
}
}

static struct __ecereNameSpace__ecere__com__Class * __ecereClass_SymbolgenApp;

extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);

extern int strlen(const char * );

extern int __ecereNameSpace__ecere__com__GetPlatformFromKeyword(char *  keyword);

extern void SetSymbolsDir(char *  s);

extern int printf(char * , ...);

extern char *  __ecereNameSpace__ecere__sys__GetExtension(char *  string, char *  output);

extern void SetDefines(struct __ecereNameSpace__ecere__sys__OldList *  list);

extern void SetImports(struct __ecereNameSpace__ecere__sys__OldList *  list);

extern void SetGlobalData(struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace);

extern void SetExcludedSymbols(struct __ecereNameSpace__ecere__sys__OldList *  list);

extern void SetGlobalContext(struct Context * context);

extern void SetTopContext(struct Context * context);

extern void SetCurrentContext(struct Context * context);

extern void SetTargetPlatform(int platform);

extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__com____ecere_COM_Initialize(unsigned int guiApp, int argc, char *  argv[]);

extern void SetPrivateModule(struct __ecereNameSpace__ecere__com__Instance * module);

extern int strcasecmp(const char * , const char * );

extern unsigned int LoadSymbols(char *  fileName, int importType, unsigned int loadDllOnly);

extern void CheckDataRedefinitions(void);

extern void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module);

extern void FreeContext(struct Context * context);

extern void FreeExcludedSymbols(struct __ecereNameSpace__ecere__sys__OldList * excludedSymbols);

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Definition;

struct Definition;

extern void FreeModuleDefine(struct Definition * def);

extern void FreeModuleImport(struct ModuleImport * imp);

extern void FreeTypeData(struct __ecereNameSpace__ecere__com__Instance * privateModule);

extern void FreeIncludeFiles(void);

extern void FreeGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * globalDataList);

extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;

struct __ecereNameSpace__ecere__com__Application
{
int argc;
char * *  argv;
int exitCode;
unsigned int isGUIApp;
struct __ecereNameSpace__ecere__sys__OldList allModules;
char *  parsedCommand;
struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
};

void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);

void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));

void __ecereMethod_SymbolgenApp_Main(struct __ecereNameSpace__ecere__com__Instance * this)
{
void * __ecereTemp1;
char ** argv = (((void *)0));
int argc = 0;
int c;
unsigned int valid = 0x1;
char * output = (((void *)0));

targetPlatform = __ecereNameSpace__ecere__com__GetRuntimePlatform();
for(c = 0; c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + 296)))->argc; c++)
{
char * arg = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + 296)))->argv[c];
int argLen = strlen(arg);

argv = __ecereNameSpace__ecere__com__eSystem_Renew(argv, sizeof(char *) * (argc + 1));
argv[argc] = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (argLen + 1));
strcpy(argv[argc], arg);
while(argv[argc][argLen - 1] == '\\' && c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + 296)))->argc - 1)
{
int len;

c++;
arg = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + 296)))->argv[c];
len = strlen(arg);
argv[argc] = __ecereNameSpace__ecere__com__eSystem_Renew(argv[argc], sizeof(char) * (argLen + len + 1));
argv[argc][argLen - 1] = ' ';
strcpy(argv[argc] + argLen, arg);
argLen += len;
}
argc++;
}
for(c = 1; c < argc; c++)
{
char * arg = argv[c];

if(arg[0] == '-')
{
if(!strcmp(arg + 1, "o"))
{
if(!output && c + 1 < argc)
{
output = argv[c + 1];
c++;
}
else
valid = 0x0;
}
else if(!strcmp(arg, "-name"))
{
if(c + 1 < argc)
{
strcpy(projectName, argv[c + 1]);
c++;
}
else
valid = 0x0;
}
else if(!strcmp(arg, "-t"))
{
if(++c < argc)
targetPlatform = __ecereNameSpace__ecere__com__GetPlatformFromKeyword(argv[c]);
else
valid = 0x0;
}
else if(!strcmp(arg, "-console"))
isConsole = 0x1;
else if(!strcmp(arg, "-dynamiclib"))
isDynamicLibrary = 0x1;
else if(!strcmp(arg, "-staticlib"))
{
isDynamicLibrary = 0x1;
isStaticLibrary = 0x1;
}
else if(!strcmp(arg, "-symbols"))
{
if(c + 1 < argc)
{
SetSymbolsDir(argv[c + 1]);
c++;
}
else
valid = 0x0;
}
}
}
if(!output)
valid = 0x0;
if(!valid)
printf("Syntax:\n   ecs [-t <target platform>] <input>[, <input>]* -o <output>\n");
else
{
int c;
char ext[17];
char symbolModule[274];

__ecereNameSpace__ecere__sys__GetExtension(output, ext);
__ecereNameSpace__ecere__sys__GetLastDirectory(output, symbolModule);
SetDefines(&_defines);
SetImports(&_imports);
SetGlobalData(&globalData);
SetExcludedSymbols(&_excludedSymbols);
SetGlobalContext(theGlobalContext);
SetTopContext(theGlobalContext);
SetCurrentContext(theGlobalContext);
SetTargetPlatform(targetPlatform);
privateModule = __ecereNameSpace__ecere__com____ecere_COM_Initialize(0x1, 1, (((void *)0)));
SetPrivateModule(privateModule);
mainModule = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ModuleImport);
SetMainModule(mainModule);
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&_imports, mainModule);
{
for(c = 1; c < argc; c++)
{
char * file = argv[c];

if(file[0] == '-')
{
if(!strcmp(file, "-c"))
c++;
}
else
{
char ext[17];

__ecereNameSpace__ecere__sys__GetExtension(file, ext);
if(!strcmp(ext, "imp"))
LoadImports(file);
}
}
for(c = 1; c < argc; c++)
{
char * file = argv[c];

if(file[0] == '-')
{
if(!strcmp(file, "-c"))
c++;
}
}
for(c = 1; c < argc; c++)
{
char * file = argv[c];

if(file[0] == '-')
{
if(!strcmp(file, "-c"))
c++;
}
else
{
char ext[17];
char moduleName[797];

__ecereNameSpace__ecere__sys__GetExtension(file, ext);
__ecereNameSpace__ecere__sys__GetLastDirectory(file, moduleName);
__ecereNameSpace__ecere__sys__StripExtension(moduleName);
strcat(moduleName, ".ec");
if(((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? (strcasecmp) : strcmp)(moduleName, symbolModule) && (!strcmp(ext, "sym") || !strcmp(ext, "ec")))
{
struct ImportedModule * importedModule;
struct ModuleInfo * module = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ModuleInfo);
char fileName[274];

__ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&modules, module);
__ecereNameSpace__ecere__sys__GetLastDirectory(file, fileName);
module->name = __ecereNameSpace__ecere__sys__CopyString(fileName);
__ecereNameSpace__ecere__sys__StripExtension(module->name);
for(importedModule = _defines.first; importedModule; importedModule = importedModule->next)
{
if(importedModule->type == 0 && !(strcasecmp)(importedModule->name, module->name) && !(importedModule->importType == 2))
break;
}
if(importedModule)
module->globalInstance = importedModule->globalInstance;
else
{
importedModule = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ImportedModule), ((struct ImportedModule *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(module->name), ((struct ImportedModule *)__ecereTemp1)->type = 0, ((struct ImportedModule *)__ecereTemp1)->importType = 0, ((struct ImportedModule *)__ecereTemp1));
__ecereMethod___ecereNameSpace__ecere__sys__OldList_AddName(&_defines, importedModule);
module->globalInstance = LoadSymbols(file, 0, 0x0);
CheckDataRedefinitions();
}
}
}
}
ComputeModuleClasses(privateModule);
if(!isDynamicLibrary)
{
thisAppClass = SearchAppClass_Module(privateModule);
}
WriteMain(output);
}
FreeContext(theGlobalContext);
FreeExcludedSymbols(&_excludedSymbols);
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&_defines, FreeModuleDefine);
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&_imports, FreeModuleImport);
FreeTypeData(privateModule);
FreeIncludeFiles();
FreeGlobalData(&globalData);
(__ecereNameSpace__ecere__com__eInstance_DecRef(privateModule), privateModule = 0);
}
for(c = 0; c < argc; c++)
(__ecereNameSpace__ecere__com__eSystem_Delete(argv[c]), argv[c] = 0);
(__ecereNameSpace__ecere__com__eSystem_Delete(argv), argv = 0);
}

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);

extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;

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);

void __ecereRegisterModule_ecs(struct __ecereNameSpace__ecere__com__Instance * module)
{
struct __ecereNameSpace__ecere__com__Class * class;

class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "ModuleInfo", 0, sizeof(struct ModuleInfo), 0, 0, 0, module, 2, 1);
if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
__ecereClass_ModuleInfo = class;
class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(0, "SymbolgenApp", "ecere::com::Application", 0, 0, 0, 0, module, 2, 1);
if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
__ecereClass_SymbolgenApp = class;
__ecereNameSpace__ecere__com__eClass_AddMethod(class, "Main", 0, __ecereMethod_SymbolgenApp_Main, 1);
}

void __ecereUnregisterModule_ecs(struct __ecereNameSpace__ecere__com__Instance * module)
{

}

int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_CompareString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  a, char *  b);

void __ecereCreateModuleInstances_ecs()
{
(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);
theGlobalContext = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
}

void __ecereDestroyModuleInstances_ecs()
{
((theGlobalContext ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(theGlobalContext) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(theGlobalContext)) : 0), theGlobalContext = 0);
}

