changeset 34:544b922227c7

update to work with dmd 2.048
author korDen
date Sat, 21 Aug 2010 05:46:08 +0400
parents e0a36abe1184
children 69494b249ace
files commands.txt dmd/Array.d dmd/FileName.d dmd/Lexer.d dmd/OutBuffer.d dmd/Parser.d dmd/backend/code.d dmd/backend/glue.d dmd/expression/Cat.d dmd/expression/Slice.d main.d setupenv.bat
diffstat 12 files changed, 19 insertions(+), 117 deletions(-) [+]
line wrap: on
line diff
--- a/commands.txt	Sat Aug 21 05:45:28 2010 +0400
+++ b/commands.txt	Sat Aug 21 05:46:08 2010 +0400
@@ -14,10 +14,10 @@
 -version=SEH
 -version=OMFOBJ
 -version=SNAN_DEFAULT_INIT
--ofC:\dmd_2.032\windows\bin\dmd.exe
+-ofC:\dmd2.032\windows\bin\dmd.exe
 bridge.obj
 ddmd.def
-C:\dmd_2.032\src\dmd\dmd.lib
+C:\dmd2.032\src\dmd\dmd.lib
 main.d
 win32\windef.d
 win32\winuser.d
--- a/dmd/Array.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/dmd/Array.d	Sat Aug 21 05:46:08 2010 +0400
@@ -2,7 +2,7 @@
 
 import core.memory;
 
-import std.contracts;
+import std.exception;
 import core.stdc.string;
 import core.stdc.stdlib;
 
--- a/dmd/FileName.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/dmd/FileName.d	Sat Aug 21 05:46:08 2010 +0400
@@ -11,7 +11,7 @@
 import core.stdc.string : memcpy, strlen;
 import core.stdc.ctype : isspace;
 
-import std.contracts : assumeUnique;
+import std.exception : assumeUnique;
 import std.string : cmp, icmp;
 import std.file : mkdirRecurse;
 
--- a/dmd/Lexer.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/dmd/Lexer.d	Sat Aug 21 05:46:08 2010 +0400
@@ -64,7 +64,7 @@
 	
 	static ~this()
 	{
-		delete stringtable;
+		//delete stringtable;
 	}
 
     this(Module mod, ubyte* base, uint begoffset, uint endoffset, int doDocComment, int commentToken)
@@ -401,7 +401,7 @@
 		
 		for (uint u = 0; u < nkeywords; u++)
 		{
-			//printf("keyword[%d] = '%s'\n",u, keywords[u].name);
+			//printf("keyword[%d] = '%.*s'\n",u, keywords[u].name);
 			string s = keywords[u].name;
 			TOK v = keywords[u].value;
 			StringValue* sv = stringtable.insert(s);
--- a/dmd/OutBuffer.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/dmd/OutBuffer.d	Sat Aug 21 05:46:08 2010 +0400
@@ -1,7 +1,7 @@
 module dmd.OutBuffer;
 
 import std.stdarg;
-import std.contracts;
+import std.exception;
 
 import core.stdc.stdlib;
 import core.stdc.string;
--- a/dmd/Parser.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/dmd/Parser.d	Sat Aug 21 05:46:08 2010 +0400
@@ -204,7 +204,7 @@
 
 import core.stdc.string : memcpy;
 
-import std.contracts;
+import std.exception;
 import core.memory;
 
 class Parser : Lexer
--- a/dmd/backend/code.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/dmd/backend/code.d	Sat Aug 21 05:46:08 2010 +0400
@@ -140,7 +140,7 @@
 	writefln("targ_long.sizeof: %d", targ_long.sizeof);
 	foreach (a, b; foo.tupleof)
 	{
-		std.stdio.writeln(foo.tupleof[a].stringof, " ", cast(char*)&foo.tupleof[a] - cast(char*)foo, " = ", foo.tupleof[a]);
+		///std.stdio.writeln(foo.tupleof[a].stringof, " ", cast(char*)&foo.tupleof[a] - cast(char*)foo, " = ", foo.tupleof[a]);
 		//std.stdio.writeln("printf(\"", foo.tupleof[a].stringof, " %d = %d\\n\",(char*)(&", foo.tupleof[a].stringof, ")-(char*)foo, ", foo.tupleof[a].stringof, ");");
 	}
 }
\ No newline at end of file
--- a/dmd/backend/glue.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/dmd/backend/glue.d	Sat Aug 21 05:46:08 2010 +0400
@@ -38,7 +38,7 @@
 	}
 }
 
-import std.contracts;
+import std.exception;
 import std.string;
 
 string lastmname;
--- a/dmd/expression/Cat.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/dmd/expression/Cat.d	Sat Aug 21 05:46:08 2010 +0400
@@ -19,7 +19,7 @@
 import core.stdc.string;
 import core.stdc.stdlib;
 
-import std.contracts;
+import std.exception;
 
 /* Also return EXP_CANT_INTERPRET if this fails
  */
--- a/dmd/expression/Slice.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/dmd/expression/Slice.d	Sat Aug 21 05:46:08 2010 +0400
@@ -15,7 +15,7 @@
 import core.stdc.stdlib;
 import core.stdc.string;
 
-import std.contracts;
+import std.exception;
 
 
 /* Also return EXP_CANT_INTERPRET if this fails
--- a/main.d	Sat Aug 21 05:45:28 2010 +0400
+++ b/main.d	Sat Aug 21 05:46:08 2010 +0400
@@ -20,7 +20,7 @@
 
 import std.stdarg;
 import std.string : toStringz;
-import std.contracts;
+import std.exception;
 
 import core.stdc.string;
 import core.stdc.stdio;
@@ -36,120 +36,22 @@
 
 import dmd.Util;
 
-bool loop = true;
-
 enum ExitCode
 {
 	EXIT_SUCCESS = 0,
 }
 
-version (Windows)
-{
-    private import core.stdc.wchar_;
-}
-
-extern (C) void gc_init();
-extern (C) void gc_term();
-extern (C) void _minit();
-extern (C) void _moduleCtor();
-extern (C) void _moduleDtor();
-extern (C) void thread_joinAll();
-
-shared bool _d_isHalting = false;
-
-version (Windows)
-{
-   import win32.windows;
-
-	/* Link to druntimes main() */
-
-	extern (C) int main(int argc, char **argv)
-	{
-		char[][] args;
-		int result;
-
-		version (OSX)
-		{   /* OSX does not provide a way to get at the top of the
-			 * stack, except for the magic value 0xC0000000.
-			 * But as far as the gc is concerned, argv is at the top
-			 * of the main thread's stack, so save the address of that.
-			 */
-			__osx_stack_end = cast(void*)&argv;
-		}
-
-		version (Posix)
-		{
-			_STI_monitor_staticctor();
-			_STI_critical_init();
-		}
-
-		version (Windows)
-		{
-			wchar_t*  wcbuf = GetCommandLineW();
-			size_t    wclen = wcslen(wcbuf);
-			int       wargc = 0;
-			wchar_t** wargs = CommandLineToArgvW(wcbuf, &wargc);
-			assert(wargc == argc);
-
-			char*     cargp = null;
-			size_t    cargl = WideCharToMultiByte(65001, 0, wcbuf, wclen, null, 0, null, null);
+extern (C) extern __gshared bool rt_trapExceptions;
 
-			cargp = cast(char*) alloca(cargl);
-			args  = ((cast(char[]*) alloca(wargc * (char[]).sizeof)))[0 .. wargc];
-
-			for (size_t i = 0, p = 0; i < wargc; i++)
-			{
-				int wlen = wcslen(wargs[i]);
-				int clen = WideCharToMultiByte(65001, 0, &wargs[i][0], wlen, null, 0, null, null);
-				args[i]  = cargp[p .. p+clen];
-				p += clen; assert(p <= cargl);
-				WideCharToMultiByte(65001, 0, &wargs[i][0], wlen, &args[i][0], clen, null, null);
-			}
-			LocalFree(cast(HANDLE)wargs);
-			wargs = null;
-			wargc = 0;
-		}
-		else version (Posix)
-		{
-			char[]* am = cast(char[]*) malloc(argc * (char[]).sizeof);
-			scope(exit) free(am);
-
-			for (size_t i = 0; i < argc; i++)
-			{
-				auto len = strlen(argv[i]);
-				am[i] = argv[i][0 .. len];
-			}
-			args = am[0 .. argc];
-		}
-
-		gc_init();
-		version (Windows)
-			_minit();
-		_moduleCtor();
-		
-		GC.disable();
-		CrashHandlerInit();
-
-		result = main(cast(string[])args);
-		
-		thread_joinAll();
-		_d_isHalting = true;
-		_moduleDtor();
-		gc_term();
-
-		version (Posix)
-		{
-			_STD_critical_term();
-			_STD_monitor_staticdtor();
-		}
-
-		return result;
-	}
+static this() {
+	rt_trapExceptions = false;
 }
 
 int main(string[] args)
 {
     GC.disable();
+	CrashHandlerInit();
+	
     Array files = new Array();
     Array libmodules = new Array();
     Module m;
--- a/setupenv.bat	Sat Aug 21 05:45:28 2010 +0400
+++ b/setupenv.bat	Sat Aug 21 05:46:08 2010 +0400
@@ -1,1 +1,1 @@
-set path=c:\dm\bin;c:\dmd_2.046\windows\bin;%PATH%
\ No newline at end of file
+set path=c:\dm\bin;c:\dmd2.048\windows\bin;%PATH%
\ No newline at end of file