dmd 2.026 + DFL rev78 (Revisited)
説明の順序がおかしかったので修正しました.
svn co http://svn.dsource.org/projects/dfl/trunk/win32 dfldsource/win32
にある最新の DFL には -version=DFL_DMD2020 は実装されていますが,dmd 2.021 での変更に対応した -version=DFL_DMD2021 とでも呼べるものは未実装なので作りました.
次のプログラム
import dfl.all; class MyForm : Form { TreeView tv; this() { tv = new dfl.treeview.TreeView(); tv.bounds = Rect(0, 0, 232, 228); tv.parent = this; TreeNode tn = new TreeNode("hoge"); tn.nodes.add("omg"); tv.nodes.add(tn); tv.click ~= (Object sender, EventArgs e){msgBox("piko-n");}; } void testClick(Object sender, EventArgs e) { msgBox("piko-n"); } } int main() { Application.run(new MyForm()); return 0; }
を
bud treeview.d -full -Ic:\d\dmd\src -version=Unicode -version=DFL_DMD2021
とやってコンパイルできるようにします.
まず DFL のソースを以下のように直します.
diff -U 1 -r dfl/application.d dfl2021/application.d --- dfl/application.d Sun Mar 29 02:17:08 2009 +++ dfl2021/application.d Sun Mar 29 01:39:58 2009 @@ -178,7 +178,7 @@ { - const Dstring MANIFEST = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` \r\n - `<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">` \r\n - `<description>DFL manifest</description>` \r\n - `<dependency>` \r\n - `<dependentAssembly>` \r\n + const Dstring MANIFEST = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` "\r\n" + `<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">` "\r\n" + `<description>DFL manifest</description>` "\r\n" + `<dependency>` "\r\n" + `<dependentAssembly>` "\r\n" `<assemblyIdentity ` @@ -190,6 +190,6 @@ `language="*" ` - `/>` \r\n - `</dependentAssembly>` \r\n - `</dependency>` \r\n - `</assembly>` \r\n; + `/>` "\r\n" + `</dependentAssembly>` "\r\n" + `</dependency>` "\r\n" + `</assembly>` "\r\n"; diff -U 1 -r dfl/data.d dfl2021/data.d --- dfl/data.d Sun Mar 29 02:17:08 2009 +++ dfl2021/data.d Sun Mar 29 01:40:38 2009 @@ -462,3 +462,3 @@ //return cast(void[])(data.getUnicodeText() ~ cast(Dwstring)\0); // Needed in D2. Not guaranteed safe. - return (data.getUnicodeText() ~ cast(Dwstring)\0).dup; // Needed in D2. + return (data.getUnicodeText() ~ cast(Dwstring)"\0").dup; // Needed in D2. } @@ -468,3 +468,3 @@ //return cast(void[])((*cast(Ddstring*)data.value) ~ \0); // Needed in D2. Not guaranteed safe. - return ((*cast(Ddstring*)data.value) ~ \0).dup; // Needed in D2. + return ((*cast(Ddstring*)data.value) ~ "\0").dup; // Needed in D2. } Only in dfl: dflcompile.info diff -U 1 -r dfl/drawing.d dfl2021/drawing.d --- dfl/drawing.d Sun Mar 29 02:17:08 2009 +++ dfl2021/drawing.d Sun Mar 29 02:00:29 2009 @@ -548,6 +548,16 @@ { - if(*this == Color.empty) - return wc; - if(wc == Color.empty) - return *this; + version(DFL_DMD2021) + { + if(this == Color.empty) + return wc; + if(wc == Color.empty) + return this; + } + else + { + if(*this == Color.empty) + return wc; + if(wc == Color.empty) + return *this; + } @@ -575,6 +585,16 @@ return backColor; - if(backColor == Color.empty) - return *this; - if(0xFF == this.color.alpha) - return *this; + version(DFL_DMD2021) + { + if(backColor == Color.empty) + return this; + if(0xFF == this.color.alpha) + return this; + } + else + { + if(backColor == Color.empty) + return *this; + if(0xFF == this.color.alpha) + return *this; + } diff -U 1 -r dfl/internal/dlib.d dfl2021/internal/dlib.d --- dfl/internal/dlib.d Sun Mar 29 02:17:08 2009 +++ dfl2021/internal/dlib.d Sun Mar 29 02:01:36 2009 @@ -57,2 +57,7 @@ } +version(DFL_DMD2021) +{ + version = DFL_USE_CORE_MEMORY; + version = DFL_USE_CORE_ERROR_OUTOFMEMORY; +} @@ -580,7 +585,20 @@ - class OomException: core.exception.OutOfMemoryException + version(DFL_DMD2021) { - this() + class OomException: core.exception.OutOfMemoryError { - super(null, 0); + this() + { + super(null, 0); + } + } + } + else + { + class OomException: core.exception.OutOfMemoryException + { + this() + { + super(null, 0); + } } diff -U 1 -r dfl/messagebox.d dfl2021/messagebox.d --- dfl/messagebox.d Sun Mar 29 02:17:08 2009 +++ dfl2021/messagebox.d Sun Mar 29 01:40:48 2009 @@ -62,3 +62,3 @@ { - return cast(DialogResult)dfl.internal.utf.messageBox(GetActiveWindow(), txt, \0, MB_OK); + return cast(DialogResult)dfl.internal.utf.messageBox(GetActiveWindow(), txt, "\0", MB_OK); } @@ -69,3 +69,3 @@ return cast(DialogResult)dfl.internal.utf.messageBox(owner ? owner.handle : GetActiveWindow(), - txt, \0, MB_OK); + txt, "\0", MB_OK); } diff -U 1 -r dfl/registry.d dfl2021/registry.d --- dfl/registry.d Sun Mar 29 02:17:08 2009 +++ dfl2021/registry.d Sun Mar 29 01:40:55 2009 @@ -252,3 +252,3 @@ { - result ~= str ~ \r\n; + result ~= str ~ "\r\n"; } diff -U 1 -r dfl/textbox.d dfl2021/textbox.d --- dfl/textbox.d Sun Mar 29 02:17:08 2009 +++ dfl2021/textbox.d Sun Mar 29 01:40:30 2009 @@ -113,3 +113,3 @@ { - result ~= s ~ \r\n; + result ~= s ~ "\r\n"; }
dmd を c:\d\ にインストールしているとします.
dfl は c:\d\dmd\src\dfl の位置に svn で落としてあるとして,
set dfl_flags=-version=DFL_DMD2021 set dmd_path=c:\d\dmd\windows cd c:\d\dmd\src\dfl makelib.bat copy *.lib c:\d\dmd\windows\lib
後は bud があれば,
bud treeview.d -full -Ic:\d\dmd\src -version=Unicode -version=DFL_DMD2021
とすれば OK です.
そういえばdeprecatedなコードがなくなってるみたいですね.素晴らしい.