...ing logging 4.0

はてなブログに移行しました。D言語の話とかいろいろ。

DFL rev80 + dmd 2.031

久しぶりに恒例のパッチを作りました.
今回は符号付きの型を符号なしの型に暗黙変換できなくなった変更を受けてcastを大量に挿入したのでちょっと心配.


DFLは以前のように-version=DFL_DMD2021とか付けてビルドしなくてもよいようです.
ただし,DFLのlibファイルは別にmakelib.batを実行して事前に作成しておく必要があります.
dmd.exeにパスが通っている状態で

> set dmd_path=c:\d\dmd2\windows
> set dmc_path=c:\d\dm
> makelib.bat

これで作成されたlibファイルを c:\d\dmd2\windows\lib に移動します.
後は c:\d\dmd2\src\dfl\dfl.all のような配置になっているとして,

> bud main.d -Ic:\d\dmd2\src -full

import dfl.all;
void main()
{
  Application.run(new Form());
}

コンパイルできるはず.



最終更新日:2009年7月15日

Index: base.d
===================================================================
--- base.d	(リビジョン 80)
+++ base.d	(作業コピー)
@@ -862,7 +862,7 @@
 		
 		int vk;
 		if(dfl.internal.utf.useUnicode)
-			vk = 0xFF & VkKeyScanW(ch);
+			vk = 0xFF & VkKeyScanW(cast(wchar)ch);
 		else
 			vk = 0xFF & VkKeyScanA(cast(char)ch);
 		
Index: combobox.d
===================================================================
--- combobox.d	(リビジョン 80)
+++ combobox.d	(作業コピー)
@@ -81,6 +81,7 @@
 			case CBS_SIMPLE:
 				return ComboBoxStyle.SIMPLE;
 		}
+		assert(0);
 	}
 	
 	
@@ -380,7 +381,7 @@
 			uint v1, v2;
 			prevwproc(CB_GETEDITSEL, cast(WPARAM)&v1, cast(LPARAM)&v2);
 			v2 = v1 + len;
-			prevwproc(CB_SETEDITSEL, 0, MAKELPARAM(v1, v2));
+			prevwproc(CB_SETEDITSEL, 0, MAKELPARAM(cast(ushort)v1, cast(ushort)v2));
 		}
 	}
 	
@@ -407,7 +408,7 @@
 			prevwproc(CB_GETEDITSEL, cast(WPARAM)&v1, cast(LPARAM)&v2);
 			assert(v2 >= v1);
 			v2 = pos + (v2 - v1);
-			prevwproc(CB_SETEDITSEL, 0, MAKELPARAM(pos, v2));
+			prevwproc(CB_SETEDITSEL, 0, MAKELPARAM(cast(ushort)pos, cast(ushort)v2));
 		}
 	}
 	
Index: control.d
===================================================================
--- control.d	(リビジョン 80)
+++ control.d	(作業コピー)
@@ -1501,7 +1501,7 @@
 				{
 					SendMessageA(hwnd, WM_SETCURSOR, cast(WPARAM)hwnd,
 						MAKELPARAM(
-							SendMessageA(hwnd, WM_NCHITTEST, 0, MAKELPARAM(curpt.x, curpt.y)),
+							cast(ushort)SendMessageA(hwnd, WM_NCHITTEST, 0, MAKELPARAM(cast(ushort)curpt.x, cast(ushort)curpt.y)),
 							WM_MOUSEMOVE)
 							);
 				}
Index: data.d
===================================================================
--- data.d	(リビジョン 80)
+++ data.d	(作業コピー)
@@ -920,7 +920,7 @@
 		void[] mem;
 		void* plock;
 		
-		fmte.cfFormat = id;
+		fmte.cfFormat = cast(ushort)id;
 		fmte.ptd = null;
 		fmte.dwAspect = DVASPECT_CONTENT; // ?
 		fmte.lindex = -1;
@@ -978,7 +978,7 @@
 	{
 		FORMATETC fmte;
 		
-		fmte.cfFormat = id;
+		fmte.cfFormat = cast(ushort)id;
 		fmte.ptd = null;
 		fmte.dwAspect = DVASPECT_CONTENT; // ?
 		fmte.lindex = -1;
@@ -1193,7 +1193,7 @@
 				
 				for(; idx != end; idx++)
 				{
-					rgelt.cfFormat = DataFormats.getFormat(fmts[idx]).id;
+					rgelt.cfFormat = cast(ubyte)DataFormats.getFormat(fmts[idx]).id;
 					rgelt.ptd = null;
 					rgelt.dwAspect = DVASPECT_CONTENT; // ?
 					rgelt.lindex = -1;
Index: dflcompile.info
===================================================================
--- dflcompile.info	(リビジョン 80)
+++ dflcompile.info	(作業コピー)
@@ -1 +1,51 @@
-Placeholder to force recompile.
+dlib=
+Digital Mars D Compiler v2.031
+Copyright (c) 1999-2009 by Digital Mars written by Walter Bright
+Documentation: http://www.digitalmars.com/d/2.0/index.html
+Usage:
+  dmd files.d ... { -switch }
+
+  files.d        D source files
+  @cmdfile       read arguments from cmdfile
+  -c             do not link
+  -cov           do code coverage analysis
+  -D             generate documentation
+  -Dddocdir      write documentation file to docdir directory
+  -Dffilename    write documentation file to filename
+  -d             allow deprecated features
+  -debug         compile in debug code
+  -debug=level   compile in debug code <= level
+  -debug=ident   compile in debug code identified by ident
+  -debuglib=name    set symbolic debug library to name
+  -defaultlib=name  set default library to name
+  -deps=filename write module dependencies to filename
+  -g             add symbolic debug info
+  -gc            add symbolic debug info, pretend to be C
+  -H             generate 'header' file
+  -Hdhdrdir      write 'header' file to hdrdir directory
+  -Hffilename    write 'header' file to filename
+  --help         print help
+  -Ipath         where to look for imports
+  -ignore        ignore unsupported pragmas
+  -inline        do function inlining
+  -Jpath         where to look for string imports
+  -Llinkerflag   pass linkerflag to link
+  -lib           generate library rather than object files
+  -man           open web browser on manual page
+  -nofloat       do not emit reference to floating point
+  -O             optimize
+  -o-            do not write object file
+  -odobjdir      write object & library files to directory objdir
+  -offilename	 name output file to filename
+  -op            do not strip paths from source file
+  -profile	 profile runtime performance of generated code
+  -quiet         suppress unnecessary messages
+  -release	 compile release version
+  -run srcfile args...   run resulting program, passing args
+  -safe          safe memory model
+  -unittest      compile in unit tests
+  -v             verbose
+  -version=level compile in version code >= level
+  -version=ident compile in version code identified by ident
+  -vtls          list all variables going into thread local storage
+  -w             enable warnings
Index: drawing.d
===================================================================
--- drawing.d	(リビジョン 80)
+++ drawing.d	(作業コピー)
@@ -560,9 +560,9 @@
 		validateColor();
 		wc.validateColor();
 		
-		return Color((cast(uint)color.red + cast(uint)wc.color.red) >> 1,
-			(cast(uint)color.green + cast(uint)wc.color.green) >> 1,
-			(cast(uint)color.blue + cast(uint)wc.color.blue) >> 1);
+		return Color(cast(ubyte)((cast(uint)color.red + cast(uint)wc.color.red) >> 1),
+			cast(ubyte)((cast(uint)color.green + cast(uint)wc.color.green) >> 1),
+			cast(ubyte)((cast(uint)color.blue + cast(uint)wc.color.blue) >> 1));
 	}
 	
 	
@@ -603,7 +603,7 @@
 	package static Color systemColor(int colorIndex)
 	{
 		Color c;
-		c.sysIndex = colorIndex;
+		c.sysIndex = cast(ubyte)colorIndex;
 		c.color.alpha = 0xFF;
 		return c;
 	}
@@ -1817,7 +1817,7 @@
 		norm = SystemColors.control;
 		light = SystemColors.controlLightLight.blendColor(norm); // center
 		//dark = SystemColors.controlDark.blendColor(norm); // top
-		ubyte ubmin(int ub) { if(ub <= 0) return 0; return ub; }
+		ubyte ubmin(int ub) { if(ub <= 0) return 0; return cast(ubyte)ub; }
 		dark = Color(ubmin(cast(int)norm.r - 0x10), ubmin(cast(int)norm.g - 0x10), ubmin(cast(int)norm.b - 0x10));
 		//ddark = SystemColors.controlDarkDark; // bottom
 		ddark = SystemColors.controlDark.blendColor(Color(0x10, 0x10, 0x10)); // bottom
@@ -3235,7 +3235,7 @@
 		lf.lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
 		lf.lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
 		//lf.lf.lfQuality = DEFAULT_QUALITY;
-		lf.lf.lfQuality = smoothing;
+		lf.lf.lfQuality = cast(ubyte)smoothing;
 		lf.lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
 		
 		this(_create(lf));
Index: environment.d
===================================================================
--- environment.d	(リビジョン 80)
+++ environment.d	(作業コピー)
@@ -171,7 +171,7 @@
 			if(dr & 1)
 			{
 				char[] s = tmp.dup[0 .. 3];
-				s[0] = 'A' + i;
+				s[0] = cast(char)('A' + i);
 				//result ~= s;
 				result ~= cast(Dstring)s; // Needed in D2.
 			}
Index: internal/dlib.d
===================================================================
--- internal/dlib.d	(リビジョン 80)
+++ internal/dlib.d	(作業コピー)
@@ -575,11 +575,18 @@
 	
 	alias std.string.icmp stringICmp;
 	
-	alias std.string.toString stringFromStringz;
-	
+	//alias std.string.toString stringFromStringz;
+	Dstring stringFromStringz(in char* sz)
+	{
+		return to!(Dstring)(sz);
+	}
 	alias std.string.split stringSplit;
 	
-	alias std.string.toString intToString;
+	//alias std.string.toString intToString;
+	Dstring intToString(int i)
+	{
+		return to!(Dstring)(i);
+	}
 	
 	alias std.string.find charFindInString;
 	
@@ -659,9 +666,9 @@
 	
 	private import std.conv;
 	
-	alias std.conv.toInt stringToInt;
+	//alias std.conv.toInt stringToInt;
+	int stringToInt(Dstring s){ return std.conv.to!int(s); }
 	
-	
 	private import std.ctype;
 	
 	alias std.ctype.isxdigit charIsHexDigit;
Index: listbox.d
===================================================================
--- listbox.d	(リビジョン 80)
+++ listbox.d	(作業コピー)
@@ -524,7 +524,7 @@
 		iheight = h;
 		
 		if(isHandleCreated)
-			prevwproc(LB_SETITEMHEIGHT, 0, MAKELPARAM(h, 0));
+			prevwproc(LB_SETITEMHEIGHT, 0, MAKELPARAM(cast(ushort)h, cast(ushort)0));
 	}
 	
 	/// ditto
@@ -936,7 +936,7 @@
 		
 		if(created)
 		{
-			result = prevwproc(LB_ITEMFROMPOINT, 0, MAKELPARAM(x, y));
+			result = prevwproc(LB_ITEMFROMPOINT, 0, MAKELPARAM(cast(ushort)x, cast(ushort)y));
 			if(!HIWORD(result)) // In client area
 			{
 				//result = LOWORD(result); // High word already 0.
@@ -1175,7 +1175,7 @@
 			prevwproc(LB_SETHORIZONTALEXTENT, hextent, 0);
 		
 		if(iheight != DEFAULT_ITEM_HEIGHT)
-			prevwproc(LB_SETITEMHEIGHT, 0, MAKELPARAM(iheight, 0));
+			prevwproc(LB_SETITEMHEIGHT, 0, MAKELPARAM(cast(ushort)iheight, cast(ushort)0));
 		
 		Message m;
 		m.hWnd = handle;
Index: progressbar.d
===================================================================
--- progressbar.d	(リビジョン 80)
+++ progressbar.d	(作業コピー)
@@ -38,7 +38,7 @@
 		
 		if(created)
 		{
-			prevwproc(PBM_SETRANGE, 0, MAKELPARAM(_min, max));
+			prevwproc(PBM_SETRANGE, 0, MAKELPARAM(cast(ushort)_min, cast(ushort)max));
 		}
 		
 		_max = max;
@@ -66,7 +66,7 @@
 		
 		if(created)
 		{
-			prevwproc(PBM_SETRANGE, 0, MAKELPARAM(min, _max));
+			prevwproc(PBM_SETRANGE, 0, MAKELPARAM(cast(ushort)min, cast(ushort)_max));
 		}
 		
 		_min = min;
@@ -167,7 +167,7 @@
 		
 		if(_min != MIN_INIT || _max != MAX_INIT)
 		{
-			prevwproc(PBM_SETRANGE, 0, MAKELPARAM(_min, _max));
+			prevwproc(PBM_SETRANGE, 0, MAKELPARAM(cast(ushort)_min, cast(ushort)_max));
 		}
 		
 		if(_step != STEP_INIT)
Index: richtextbox.d
===================================================================
--- richtextbox.d	(リビジョン 80)
+++ richtextbox.d	(作業コピー)
@@ -541,7 +541,7 @@
 			cf.bCharSet = lf.lfCharSet;
 			strcpy(cf.szFaceName.ptr, lf.lfFaceName.ptr);
 			cf.bUnderlineType = CFU_UNDERLINE;
-			cf.wWeight = lf.lfWeight;
+			cf.wWeight = cast(ushort)lf.lfWeight;
 			
 			_setFormat(&cf);
 		}
Index: tabcontrol.d
===================================================================
--- tabcontrol.d	(リビジョン 80)
+++ tabcontrol.d	(作業コピー)
@@ -707,7 +707,7 @@
 	{
 		if(created)
 		{
-			SendMessageA(hwnd, TCM_SETPADDING, 0, MAKELPARAM(pad.x, pad.y));
+			SendMessageA(hwnd, TCM_SETPADDING, 0, MAKELPARAM(cast(ushort)pad.x, cast(ushort)pad.y));
 			
 			TabPage page;
 			page = selectedTab;
@@ -843,7 +843,7 @@
 	{
 		super.onHandleCreated(ea);
 		
-		SendMessageA(hwnd, TCM_SETPADDING, 0, MAKELPARAM(_pad.x, _pad.y));
+		SendMessageA(hwnd, TCM_SETPADDING, 0, MAKELPARAM(cast(ushort)_pad.x, cast(ushort)_pad.y));
 		
 		tchildren.doPages();
 		
Index: textbox.d
===================================================================
--- textbox.d	(リビジョン 80)
+++ textbox.d	(作業コピー)
@@ -862,7 +862,7 @@
 			return -1; // ...
 		if(!multiline)
 			return 0;
-		auto lresult = SendMessageA(hwnd, EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y));
+		auto lresult = SendMessageA(hwnd, EM_CHARFROMPOS, 0, MAKELPARAM(cast(ushort)pt.x, cast(ushort)pt.y));
 		if(-1 == lresult)
 			return -1;
 		return cast(int)cast(short)(lresult & 0xFFFF);