compiler: Updated bootstrap
authorJerome St-Louis <jerome@ecere.com>
Tue, 5 Feb 2013 14:49:17 +0000 (09:49 -0500)
committerJerome St-Louis <jerome@ecere.com>
Sat, 16 Feb 2013 06:02:53 +0000 (01:02 -0500)
compiler/bootstrap/ecc/bootstrap/ecc.c
compiler/bootstrap/ecp/bootstrap/ecp.c
compiler/bootstrap/ecs/bootstrap/ecs.c
compiler/bootstrap/libec/bootstrap/ecdefs.c
compiler/bootstrap/libec/bootstrap/pass15.c

index 4aac39f..77fd1bf 100644 (file)
@@ -849,7 +849,7 @@ int c;
 unsigned int valid = 0x1;
 char defaultOutputFile[797];
 int targetPlatform = __ecereNameSpace__ecere__com__GetRuntimePlatform();
-int targetBits = (sizeof(uintptr_t) == 8) ? 64 : 32;
+int targetBits = GetHostBits();
 
 SetSymbolsDir("");
 for(c = 1; c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + 300)))->argc; c++)
index 7be3a2d..75366e1 100644 (file)
@@ -2506,7 +2506,7 @@ char * cppCommand = (((void *)0));
 char * cppOptions = (((void *)0));
 int cppOptionsLen = 0;
 int targetPlatform = __ecereNameSpace__ecere__com__GetRuntimePlatform();
-int targetBits = (sizeof(uintptr_t) == 8) ? 64 : 32;
+int targetBits = GetHostBits();
 
 for(c = 1; c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + 300)))->argc; c++)
 {
index 2d98560..ef0f8af 100644 (file)
@@ -492,7 +492,7 @@ static unsigned int i18n;
 
 static int targetPlatform;
 
-static int targetBits = (sizeof(uintptr_t) == 8) ? 64 : 32;
+static int targetBits;
 
 static unsigned int isConsole;
 
@@ -2318,6 +2318,7 @@ unsigned int valid = 0x1;
 char * output = (((void *)0));
 
 targetPlatform = __ecereNameSpace__ecere__com__GetRuntimePlatform();
+targetBits = GetHostBits();
 for(c = 1; c < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + 300)))->argc; c++)
 {
 char * arg = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + 300)))->argv[c];
index aec39b8..ac94788 100644 (file)
@@ -1730,6 +1730,43 @@ return 0;
 
 int targetPlatform;
 
+extern char *  getenv(const char *  name);
+
+extern struct __ecereNameSpace__ecere__com__Instance * __ecereNameSpace__ecere__sys__DualPipeOpen(unsigned int mode, char *  commandLine);
+
+extern int strcmp(const char * , const char * );
+
+unsigned int __ecereMethod___ecereNameSpace__ecere__sys__File_GetLine(struct __ecereNameSpace__ecere__com__Instance * this, char *  s, int max);
+
+extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
+
+int GetHostBits()
+{
+int hostBits = (sizeof(uintptr_t) == 8) ? 64 : 32;
+char * hostType = getenv("HOSTTYPE");
+char host[256];
+
+if(!hostType)
+{
+struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__sys__DualPipeOpen((((unsigned int)(0x1))), "uname -m");
+
+if(f)
+{
+if(__ecereMethod___ecereNameSpace__ecere__sys__File_GetLine(f, host, sizeof host))
+hostType = host;
+(__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
+}
+}
+if(hostType)
+{
+if(!strcmp(hostType, "x86_64"))
+hostBits = 64;
+else if(!strcmp(hostType, "i386") || !strcmp(hostType, "i686"))
+hostBits = 32;
+}
+return hostBits;
+}
+
 void SetTargetPlatform(int platform)
 {
 targetPlatform = platform;
@@ -2791,6 +2828,7 @@ __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Compiler_Error", "void C
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetNumWarnings", "int GetNumWarnings(void)", GetNumWarnings, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Compiler_Warning", "void Compiler_Warning(char * format, ...)", Compiler_Warning, module, 2);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("yyerror", "int yyerror(char * s)", yyerror, module, 2);
+__ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetHostBits", "int GetHostBits(void)", GetHostBits, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetTargetPlatform", "void SetTargetPlatform(ecere::com::Platform platform)", SetTargetPlatform, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetTargetBits", "void SetTargetBits(int bits)", SetTargetBits, module, 1);
 }
index dbeef54..d9f94a1 100644 (file)
@@ -16275,6 +16275,22 @@ thisClass = (((void *)0));
 }
 }
 
+void DeclareFunctionUtil(char * s)
+{
+struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
+
+if(function)
+{
+char name[1024];
+
+name[0] = (char)0;
+if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
+strcpy(name, "__ecereFunction_");
+FullClassNameCat(name, s, 0x0);
+DeclareFunction(function, name);
+}
+}
+
 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
 
 void ComputeDataTypes()
@@ -16288,6 +16304,10 @@ containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModul
 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), (((void *)0)), temp);
 curExternal = temp;
+DeclareFunctionUtil("eSystem_New");
+DeclareFunctionUtil("eSystem_New0");
+DeclareFunctionUtil("eSystem_Renew");
+DeclareFunctionUtil("eSystem_Renew0");
 DeclareStruct("ecere::com::Class", 0x0);
 DeclareStruct("ecere::com::Instance", 0x0);
 DeclareStruct("ecere::com::Property", 0x0);
@@ -16417,6 +16437,7 @@ __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString",
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
+__ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
 }