i18n: (#858) Handling localization for libraries within static executables
[sdk] / compiler / bootstrap / ecere / bootstrap / System.c
index f660f01..c9b5229 100644 (file)
@@ -1,3 +1,4 @@
+/* Code generated from eC source file: System.ec */
 #if defined(__GNUC__)
 typedef long long int64;
 typedef unsigned long long uint64;
@@ -28,6 +29,18 @@ typedef unsigned __int64 uint64;
 #define __ENDIAN_PAD(x) 0
 #endif
 #include <stdint.h>
+#include <sys/types.h>
+
+#if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
+#define _64BIT 1
+#else
+#define _64BIT 0
+#endif
+
+#define arch_PointerSize                  sizeof(void *)
+#define structSize_Instance               (_64BIT ? 24 : 12)
+#define structSize_OldList                (_64BIT ? 32 : 20)
+
 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
 
 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
@@ -117,6 +130,8 @@ struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
 struct __ecereNameSpace__ecere__com__Class * templateClass;
 struct __ecereNameSpace__ecere__sys__OldList templatized;
 int numParams;
+unsigned int isInstanceClass;
+unsigned int byValueSystemClass;
 } __attribute__ ((gcc_struct));
 
 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
@@ -255,11 +270,7 @@ struct __ecereNameSpace__ecere__com__Method * method;
 } __attribute__ ((gcc_struct));
 } __attribute__ ((gcc_struct));
 
-typedef __builtin_va_list __gnuc_va_list;
-
-typedef __gnuc_va_list va_list;
-
-typedef uintptr_t size_t;
+typedef __builtin_va_list va_list;
 
 void exit(int status);
 
@@ -341,7 +352,7 @@ void System_SetEnvironment(char * envName, char * envValue);
 
 void System_UnsetEnvironment(char * envName);
 
-unsigned int System_Execute(char * env, char * command, va_list args);
+unsigned int System_Execute(char * env, char * command, va_list args, unsigned int wait);
 
 unsigned int System_ShellOpen(char * fileName, va_list args);
 
@@ -366,9 +377,7 @@ unsigned int count;
 unsigned int minAllocSize;
 } __attribute__ ((gcc_struct));
 
-extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
-
-extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
+extern char *  __ecereNameSpace__ecere__GetTranslatedString(char * name, char *  string, char *  stringAndContext);
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BuiltInContainer;
 
@@ -440,7 +449,18 @@ unsigned int result;
 va_list args;
 
 __builtin_va_start(args, command);
-result = System_Execute((((void *)0)), command, args);
+result = System_Execute((((void *)0)), command, args, 0x0);
+__builtin_va_end(args);
+return result;
+}
+
+unsigned int __ecereNameSpace__ecere__sys__ExecuteWait(char * command, ...)
+{
+unsigned int result;
+va_list args;
+
+__builtin_va_start(args, command);
+result = System_Execute((((void *)0)), command, args, 0x1);
 __builtin_va_end(args);
 return result;
 }
@@ -451,7 +471,7 @@ unsigned int result;
 va_list args;
 
 __builtin_va_start(args, command);
-result = System_Execute(env, command, args);
+result = System_Execute(env, command, args, 0x0);
 __builtin_va_end(args);
 return result;
 }
@@ -512,6 +532,8 @@ extern char *  strcat(char * , const char * );
 
 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts;
 
+extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__File;
+
 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
 
 void __ecereNameSpace__ecere__sys__Log(char * text)
@@ -533,7 +555,11 @@ struct __ecereNameSpace__ecere__com__Instance * f;
 
 if((f = __ecereNameSpace__ecere__sys__FileOpen(__ecereNameSpace__ecere__sys__globalSystem.logFile, 3)))
 {
-((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, text);
+((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))__extension__ ({
+struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
+
+__internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
+})[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, text);
 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
 }
 break;
@@ -564,9 +590,9 @@ void __ecereNameSpace__ecere__sys__LogErrorCode(unsigned int errorCode, char * d
 if(((int)((errorCode & 0x3000) >> 12)) <= __ecereNameSpace__ecere__sys__globalSystem.errorLevel)
 {
 if(details)
-__ecereNameSpace__ecere__sys__Logf("System Error [%d]: %s (%s).\n", ((int)((errorCode & 0x3000) >> 12)), ((char **)((struct __ecereNameSpace__ecere__com__Array *)(((char *)__ecereNameSpace__ecere__sys__errorMessages + 12)))->array)[((unsigned int)((errorCode & 0xFFF) >> 0))], details);
+__ecereNameSpace__ecere__sys__Logf("System Error [%d]: %s (%s).\n", ((int)((errorCode & 0x3000) >> 12)), ((char **)((struct __ecereNameSpace__ecere__com__Array *)(((char *)__ecereNameSpace__ecere__sys__errorMessages + structSize_Instance)))->array)[((unsigned int)((errorCode & 0xFFF) >> 0))], details);
 else
-__ecereNameSpace__ecere__sys__Logf("System Error [%d]: %s.\n", ((int)((errorCode & 0x3000) >> 12)), ((char **)((struct __ecereNameSpace__ecere__com__Array *)(((char *)__ecereNameSpace__ecere__sys__errorMessages + 12)))->array)[((unsigned int)((errorCode & 0xFFF) >> 0))]);
+__ecereNameSpace__ecere__sys__Logf("System Error [%d]: %s.\n", ((int)((errorCode & 0x3000) >> 12)), ((char **)((struct __ecereNameSpace__ecere__com__Array *)(((char *)__ecereNameSpace__ecere__sys__errorMessages + structSize_Instance)))->array)[((unsigned int)((errorCode & 0xFFF) >> 0))]);
 }
 __ecereNameSpace__ecere__sys__globalSystem.lastErrorCode = errorCode;
 }
@@ -623,7 +649,7 @@ __ecereNameSpace__ecere__sys__globalSystem.errorBufferSize = 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__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
 
@@ -661,6 +687,8 @@ struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
 } __attribute__ ((gcc_struct));
 
+extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
+
 extern void __ecereNameSpace__ecere__com__eEnum_AddFixedValue(struct __ecereNameSpace__ecere__com__Class * _class, char *  string, int value);
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
@@ -688,7 +716,7 @@ void __ecereRegisterModule_System(struct __ecereNameSpace__ecere__com__Instance
 struct __ecereNameSpace__ecere__com__Class * class;
 
 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(4, "ecere::sys::LoggingMode", 0, 0, 0, 0, 0, module, 1, 1);
-if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
+if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
 __ecereClass___ecereNameSpace__ecere__sys__LoggingMode = class;
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "noLogging", 0);
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "stdOut", 1);
@@ -698,7 +726,7 @@ __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "logFile", 4);
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "msgBox", 5);
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "buffer", 6);
 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(4, "ecere::sys::ErrorLevel", 0, 0, 0, 0, 0, module, 1, 1);
-if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
+if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
 __ecereClass___ecereNameSpace__ecere__sys__ErrorLevel = class;
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "veryFatal", 0);
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "fatal", 1);
@@ -706,12 +734,12 @@ __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "major", 2);
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "minor", 3);
 __ecereNameSpace__ecere__com__eSystem_RegisterDefine("ecere::sys::AllErrors", "ecere::sys::ErrorLevel::Minor", module, 1);
 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(2, "ecere::sys::ErrorCode", 0, 0, 0, 0, 0, module, 1, 1);
-if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
+if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
 __ecereClass___ecereNameSpace__ecere__sys__ErrorCode = class;
 __ecereNameSpace__ecere__com__eClass_AddBitMember(class, "level", "ecere::sys::ErrorLevel", 2, 12, 2);
 __ecereNameSpace__ecere__com__eClass_AddBitMember(class, "code", "uint", 12, 0, 2);
 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(4, "ecere::sys::SysErrorCode", "ecere::sys::ErrorCode", 0, 0, 0, 0, module, 1, 1);
-if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
+if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
 __ecereClass___ecereNameSpace__ecere__sys__SysErrorCode = class;
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "allocationFailed", 0);
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "nameInexistant", 1);
@@ -730,6 +758,7 @@ __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::GetEnvironme
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::SetEnvironment", "void ecere::sys::SetEnvironment(char * envName, char * envValue)", __ecereNameSpace__ecere__sys__SetEnvironment, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::UnsetEnvironment", "void ecere::sys::UnsetEnvironment(char * envName)", __ecereNameSpace__ecere__sys__UnsetEnvironment, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::Execute", "bool ecere::sys::Execute(char * command, ...)", __ecereNameSpace__ecere__sys__Execute, module, 1);
+__ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::ExecuteWait", "bool ecere::sys::ExecuteWait(char * command, ...)", __ecereNameSpace__ecere__sys__ExecuteWait, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::ExecuteEnv", "bool ecere::sys::ExecuteEnv(char * env, char * command, ...)", __ecereNameSpace__ecere__sys__ExecuteEnv, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::ShellOpen", "bool ecere::sys::ShellOpen(char * fileName, ...)", __ecereNameSpace__ecere__sys__ShellOpen, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::GetFreeSpace", "void ecere::sys::GetFreeSpace(char * path, FileSize64 * size)", __ecereNameSpace__ecere__sys__GetFreeSpace, module, 1);
@@ -742,18 +771,18 @@ __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::ResetError",
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::SetErrorLevel", "void ecere::sys::SetErrorLevel(ecere::sys::ErrorLevel level)", __ecereNameSpace__ecere__sys__SetErrorLevel, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::SetLoggingMode", "void ecere::sys::SetLoggingMode(ecere::sys::LoggingMode mode, void * where)", __ecereNameSpace__ecere__sys__SetLoggingMode, module, 1);
 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(1, "ecere::sys::System", 0, sizeof(struct __ecereNameSpace__ecere__sys__System), 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)
+if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
 __ecereClass___ecereNameSpace__ecere__sys__System = class;
 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "errorLoggingMode", "ecere::sys::LoggingMode", 4, 4, 1);
-__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "errorBuffer", "char *", 4, 4, 1);
+__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "errorBuffer", "char *", arch_PointerSize, arch_PointerSize, 1);
 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "errorBufferSize", "int", 4, 4, 1);
 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "logFile", "char[MAX_LOCATION]", 797, 1, 1);
 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "lastErrorCode", "ecere::sys::ErrorCode", 4, 4, 1);
 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "errorLevel", "ecere::sys::ErrorLevel", 4, 4, 1);
-__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "eventSemaphore", "Semaphore", 4, 4, 1);
-__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "fileMonitors", "ecere::sys::OldList", 20, 4, 1);
-__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "fileMonitorMutex", "Mutex", 4, 4, 1);
-__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "fileMonitorThread", "Thread", 4, 4, 1);
+__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "eventSemaphore", "Semaphore", arch_PointerSize, arch_PointerSize, 1);
+__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "fileMonitors", "ecere::sys::OldList", structSize_OldList, arch_PointerSize, 1);
+__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "fileMonitorMutex", "Mutex", arch_PointerSize, arch_PointerSize, 1);
+__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "fileMonitorThread", "Thread", arch_PointerSize, arch_PointerSize, 1);
 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "systemTerminate", "bool", 4, 4, 1);
 }
 
@@ -778,7 +807,7 @@ void __ecereCreateModuleInstances_System()
 {
 __ecereClass___ecereNameSpace__ecere__com__BuiltInContainer->_vTbl, __ecereClass___ecereNameSpace__ecere__com__BuiltInContainer, 0, __extension__ (char * [])
 {
-__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No error", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Memory allocation failed", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Inexistant string identifier specified", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Identic string identifier already exists", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Shared library loading failed", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "File not found", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't write to file", (((void *)0)))
+__ecereNameSpace__ecere__GetTranslatedString("ecere", "No error", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString("ecere", "Memory allocation failed", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString("ecere", "Inexistant string identifier specified", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString("ecere", "Identic string identifier already exists", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString("ecere", "Shared library loading failed", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString("ecere", "File not found", (((void *)0))), __ecereNameSpace__ecere__GetTranslatedString("ecere", "Couldn't write to file", (((void *)0)))
 }, 7, __ecereClass_String
 })));
 __ecereNameSpace__ecere__com__eInstance_IncRef(__ecereNameSpace__ecere__sys__errorMessages);