# HG changeset patch # User Frank Benoit # Date 1237976305 -3600 # Node ID 2e09b0e6857a1863ba0d0f2a05cc542dfab50de6 # Parent 46c5f8f56b4117012884ddccebb23719ab9087aa work on phobosfication diff -r 46c5f8f56b41 -r 2e09b0e6857a base/src/java/lang/System.d --- a/base/src/java/lang/System.d Wed Mar 25 08:46:48 2009 +0100 +++ b/base/src/java/lang/System.d Wed Mar 25 11:18:25 2009 +0100 @@ -80,7 +80,12 @@ } } - static void arraycopy(T[] src, uint srcPos, T[] dest, uint destPos, uint len) + version(D_Version2){ + mixin("alias const(T) CT;"); + } else { // D1 + alias T CT; + } + static void arraycopy(CT[] src, uint srcPos, T[] dest, uint destPos, uint len) { if(len == 0) return; @@ -88,19 +93,21 @@ assert(dest); debug{validCheck(src.length - srcPos, dest.length - destPos, len);} - if(src is dest){ + // overlapping? + if((src.ptr <= dest.ptr && src.ptr + len > dest.ptr) + ||(src.ptr >= dest.ptr && src.ptr < dest.ptr + len)){ if( destPos < srcPos ){ for(int i=0; i=0; --i){ - dest[destPos+i] = src[srcPos+i]; + dest[destPos+i] = cast(T)src[srcPos+i]; } } }else{ - dest[destPos..(len+destPos)] = src[srcPos..(len+srcPos)]; + dest[destPos..(len+destPos)] = cast(T[])src[srcPos..(len+srcPos)]; } } } diff -r 46c5f8f56b41 -r 2e09b0e6857a base/src/java/lang/util.d --- a/base/src/java/lang/util.d Wed Mar 25 08:46:48 2009 +0100 +++ b/base/src/java/lang/util.d Wed Mar 25 11:18:25 2009 +0100 @@ -120,6 +120,15 @@ } } +version( D_Version2 ){ +} else { // D1 + String16 idup( String16 str ){ + return str.dup; + } + String idup( String str ){ + return str.dup; + } +} private struct GCStats { size_t poolsize; // total size of pool @@ -219,7 +228,7 @@ } template getImportData(String name ){ - const ImportData getImportData = ImportData( import(name), name ); + const ImportData getImportData = ImportData( cast(void[]) import(name), name ); } diff -r 46c5f8f56b41 -r 2e09b0e6857a base/src/java/lang/wrappers.d --- a/base/src/java/lang/wrappers.d Wed Mar 25 08:46:48 2009 +0100 +++ b/base/src/java/lang/wrappers.d Wed Mar 25 11:18:25 2009 +0100 @@ -12,6 +12,13 @@ public this( T[] data ){ array = data; } + version(D_Version2){ + static if( is(T == char )){ + public this( String data ){ + array = data.dup; + } + } + } public override equals_t opEquals( Object o ){ if( auto other = cast(ArrayWrapperT!(T))o){ return array == other.array; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/SWTError.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/SWTError.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/SWTError.d Wed Mar 25 11:18:25 2009 +0100 @@ -53,11 +53,11 @@ * The underlying throwable that caused the problem, * or null if this information is not available. */ - public Exception throwable( Exception e ){ + public Throwable throwable( Throwable e ){ this.next = e; return this.next; } - public Exception throwable(){ + public Throwable throwable(){ return this.next; } @@ -120,7 +120,7 @@ * * @since 3.1 */ -public Exception getCause() { +public Throwable getCause() { return throwable; } diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/SWTException.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/SWTException.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/SWTException.d Wed Mar 25 11:18:25 2009 +0100 @@ -44,11 +44,11 @@ * The underlying throwable that caused the problem, * or null if this information is not available. */ - public Exception throwable( Exception e ){ + public Throwable throwable( Throwable e ){ this.next = e; return this.next; } - public Exception throwable(){ + public Throwable throwable(){ return this.next; } @@ -112,7 +112,7 @@ * * @since 3.1 */ -public Exception getCause() { +public Throwable getCause() { return throwable; } diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/KeyEvent.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/KeyEvent.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/KeyEvent.d Wed Mar 25 11:18:25 2009 +0100 @@ -78,7 +78,7 @@ */ public bool doit; - static final long serialVersionUID = 3256442491011412789L; + static const long serialVersionUID = 3256442491011412789L; /** * Constructs a new instance of this class based on the diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/SelectionListener.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/SelectionListener.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/events/SelectionListener.d Wed Mar 25 11:18:25 2009 +0100 @@ -16,8 +16,13 @@ public import org.eclipse.swt.internal.SWTEventListener; public import org.eclipse.swt.events.SelectionEvent; -import tango.core.Traits; -import tango.core.Tuple; +version(Tango){ + import tango.core.Traits; + import tango.core.Tuple; +} else { // Phobos + import std.traits; + import std.typetuple; +} /** * Classes which implement this interface provide methods @@ -75,9 +80,15 @@ /// SWT extension private class _DgSelectionListenerT(Dg,T...) : SelectionListener { - alias ParameterTupleOf!(Dg) DgArgs; - static assert( is(DgArgs == Tuple!(SelectionEvent,T)), + version(Tango){ + alias ParameterTupleOf!(Dg) DgArgs; + static assert( is(DgArgs == Tuple!(CTabFolderEvent,T)), "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" ); + } else { // Phobos + alias ParameterTypeTuple!(Dg) DgArgs; + static assert( is(DgArgs == TypeTuple!(CTabFolderEvent,T)), + "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" ); + } Dg dg; T t; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d Wed Mar 25 11:18:25 2009 +0100 @@ -1203,7 +1203,7 @@ Status function( Handle format, float firstTabOffset, int count, float* tabStops) GdipSetStringFormatTabStops; struct Symbol { - char[] name; + String name; void** symbol; } diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsEmbedString.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsEmbedString.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsEmbedString.d Wed Mar 25 11:18:25 2009 +0100 @@ -7,85 +7,85 @@ import XPCOM = org.eclipse.swt.internal.mozilla.XPCOM; scope class nsEmbedString -{ - this(wchar[] s) - { - nsresult result; - result = NS_StringContainerInit2(&str, s.ptr, s.length, 0); - if (XPCOM.NS_FAILED(result)) - throw new Exception("Init string container fail"); - } +{ + this(wchar[] s) + { + nsresult result; + result = NS_StringContainerInit2(&str, s.ptr, s.length, 0); + if (XPCOM.NS_FAILED(result)) + throw new Exception("Init string container fail"); + } - this() - { - nsresult result; - result = NS_StringContainerInit(&str); - if (XPCOM.NS_FAILED(result)) - throw new Exception("Init string container fail"); - } + this() + { + nsresult result; + result = NS_StringContainerInit(&str); + if (XPCOM.NS_FAILED(result)) + throw new Exception("Init string container fail"); + } - nsAString* opCast() - { - return cast(nsAString*)&str; - } + nsAString* opCast() + { + return cast(nsAString*)&str; + } - wchar[] toString16() - { - wchar* buffer = null; - PRBool terminated; - uint len = NS_StringGetData(cast(nsAString*)&str, &buffer, &terminated); - return buffer[0 .. len].dup; - } + wchar[] toString16() + { + wchar* buffer = null; + PRBool terminated; + uint len = NS_StringGetData(cast(nsAString*)&str, &buffer, &terminated); + return buffer[0 .. len].dup; + } - char[] toString() + override String toString() { return String_valueOf(this.toString16()); } ~this() - { - NS_StringContainerFinish(&str); - } + { + NS_StringContainerFinish(&str); + } private: - nsStringContainer str; + nsStringContainer str; } scope class nsEmbedCString { - this(char[] s) - { - nsresult result; - result = NS_CStringContainerInit2(&str, s.ptr, s.length, 0); - if (XPCOM.NS_FAILED(result)) - throw new Exception("Init string container fail"); - } + this(char[] s) + { + nsresult result; + result = NS_CStringContainerInit2(&str, s.ptr, s.length, 0); + if (XPCOM.NS_FAILED(result)) + throw new Exception("Init string container fail"); + } - this() - { - nsresult result; - result = NS_CStringContainerInit(&str); - if (XPCOM.NS_FAILED(result)) - throw new Exception("Init string container fail"); - } + this() + { + nsresult result; + result = NS_CStringContainerInit(&str); + if (XPCOM.NS_FAILED(result)) + throw new Exception("Init string container fail"); + } - nsACString* opCast() - { - return cast(nsACString*)&str; - } + nsACString* opCast() + { + return cast(nsACString*)&str; + } - char[] toString() - { - char* buffer = null; - PRBool terminated; - uint len = NS_CStringGetData(cast(nsACString*)&str, &buffer, &terminated); + override String toString() + { + char* buffer = null; + PRBool terminated; + uint len = NS_CStringGetData(cast(nsACString*)&str, &buffer, &terminated); return buffer[0 .. len].dup; - } + } - ~this() - { - NS_CStringContainerFinish(&str); - } + ~this() + { + NS_CStringContainerFinish(&str); + } private: - nsCStringContainer str; + nsCStringContainer str; } diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMAPI.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMAPI.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMAPI.d Wed Mar 25 11:18:25 2009 +0100 @@ -11,12 +11,12 @@ //private import std.c.windows.windows; //private import std.c.windows.com; -private import org.eclipse.swt.internal.win32.WINTYPES; -private import org.eclipse.swt.internal.ole.win32.COMTYPES; -private import org.eclipse.swt.internal.ole.win32.OBJIDL; -private import org.eclipse.swt.internal.ole.win32.OLEIDL; -private import org.eclipse.swt.internal.ole.win32.OAIDL; -private import org.eclipse.swt.internal.ole.win32.extras; +import org.eclipse.swt.internal.win32.WINTYPES; +import org.eclipse.swt.internal.ole.win32.COMTYPES; +import org.eclipse.swt.internal.ole.win32.OBJIDL; +import org.eclipse.swt.internal.ole.win32.OLEIDL; +import org.eclipse.swt.internal.ole.win32.OAIDL; +import org.eclipse.swt.internal.ole.win32.extras; extern(Windows){ @@ -39,7 +39,7 @@ REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, - REFIID riid, + REFCIID riid, LPVOID * ppv ); void CoFreeUnusedLibraries(); @@ -47,7 +47,7 @@ REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO * pServerInfo, - REFIID riid, + REFCIID riid, LPVOID * ppv ); STDAPI CoLockObjectExternal( @@ -74,16 +74,16 @@ CLSID * pclsid ); WINOLEAPI IIDFromString( - LPOLESTR lpsz, + LPCOLESTR lpsz, LPIID lpiid ); BOOL IsEqualGUID( - REFGUID rguid1, - REFGUID rguid2 + REFCGUID rguid1, + REFCGUID rguid2 ); WINOLEAPI OleCreate( REFCLSID rclsid, //CLSID of embedded object to be created - REFIID riid, //Reference to the identifier of the interface + REFCIID riid, //Reference to the identifier of the interface // used to communicate with new object DWORD renderopt, //RENDEROPT value indicating cached capabilities FORMATETC * pFormatEtc, @@ -98,7 +98,7 @@ REFCLSID rclsid, //Reserved. Must be CLSID_NULL LPCOLESTR lpszFileName, //Pointer to full path of file used to // create object - REFIID riid, //Reference to the identifier of the + REFCIID riid, //Reference to the identifier of the // interface to be used to communicate with // new object DWORD renderopt, //Value from OLERENDER @@ -239,7 +239,7 @@ LPOLESTR * ppsz ); BSTR SysAllocString( - OLECHAR * sz + LPCOLESTR sz ); VOID SysFreeString( BSTR bstr diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMTYPES.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMTYPES.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMTYPES.d Wed Mar 25 11:18:25 2009 +0100 @@ -15,6 +15,13 @@ // private import org.eclipse.swt.internal.ole.win32.extras; +alias WCHAR OLECHAR; +alias OLECHAR *LPOLESTR; +version(D_Version2){ + mixin("alias const(OLECHAR) *LPCOLESTR;"); +} else { // D1 + alias OLECHAR *LPCOLESTR; +} alias IID* LPIID; alias HRESULT STDAPI; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/MSHTMHST.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/MSHTMHST.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/MSHTMHST.d Wed Mar 25 11:18:25 2009 +0100 @@ -13,6 +13,7 @@ //private import std.c.windows.windows; //private import std.c.windows.com; import org.eclipse.swt.internal.win32.OS; +import org.eclipse.swt.internal.ole.win32.COMTYPES; //import win32.oleextra; private import org.eclipse.swt.internal.ole.win32.extras; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OAIDL.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OAIDL.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OAIDL.d Wed Mar 25 11:18:25 2009 +0100 @@ -12,6 +12,7 @@ //private import std.c.windows.windows; //private import std.c.windows.com; private import org.eclipse.swt.internal.ole.win32.OBJIDL; +private import org.eclipse.swt.internal.ole.win32.COMTYPES; private import org.eclipse.swt.internal.ole.win32.extras; private import org.eclipse.swt.internal.win32.WINTYPES; private import org.eclipse.swt.ole.win32.Variant; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OBJIDL.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OBJIDL.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OBJIDL.d Wed Mar 25 11:18:25 2009 +0100 @@ -9,8 +9,9 @@ //-------------------------------------------------------------------------- -private import org.eclipse.swt.internal.ole.win32.extras; -private import org.eclipse.swt.internal.win32.WINTYPES; +import org.eclipse.swt.internal.ole.win32.extras; +import org.eclipse.swt.internal.win32.WINTYPES; +import org.eclipse.swt.internal.ole.win32.COMTYPES; // private import std.c.windows.windows; // private import std.c.windows.com; // private import org.eclipse.swt.internal.win32.os; @@ -375,18 +376,18 @@ interface IStorage : IUnknown { - HRESULT CreateStream( OLECHAR *pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream * ppstm); - HRESULT OpenStream( OLECHAR *pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream * ppstm); - HRESULT CreateStorage( OLECHAR *pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStorage * ppstg); - HRESULT OpenStorage( OLECHAR *pwcsName, IStorage pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage * ppstg ); + HRESULT CreateStream( LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream * ppstm); + HRESULT OpenStream( LPCOLESTR pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream * ppstm); + HRESULT CreateStorage( LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStorage * ppstg); + HRESULT OpenStorage( LPCOLESTR pwcsName, IStorage pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage * ppstg ); HRESULT CopyTo( DWORD ciidExclude, IID *rgiidExclude, SNB snbExclude, IStorage pstgDest ); - HRESULT MoveElementTo( OLECHAR * pwcsName, IStorage pstgDest, OLECHAR *pwcsNewName, DWORD grfFlags ); + HRESULT MoveElementTo( LPCOLESTR pwcsName, IStorage pstgDest, LPCOLESTR pwcsNewName, DWORD grfFlags ); HRESULT Commit( DWORD grfCommitFlags ); HRESULT Revert(); HRESULT EnumElements( DWORD reserved1, void *reserved2, DWORD reserved3, IEnumSTATSTG * ppenum); - HRESULT DestroyElement( OLECHAR * pwcsName ); - HRESULT RenameElement( OLECHAR *pwcsOldName, OLECHAR *pwcsNewName ); - HRESULT SetElementTimes( OLECHAR * pwcsName, FILETIME * pctime, FILETIME *patime, FILETIME *pmtime ); + HRESULT DestroyElement( LPCOLESTR pwcsName ); + HRESULT RenameElement( LPCOLESTR pwcsOldName, LPCOLESTR pwcsNewName ); + HRESULT SetElementTimes( LPCOLESTR pwcsName, FILETIME * pctime, FILETIME *patime, FILETIME *pmtime ); HRESULT SetClass( REFCLSID clsid ); HRESULT SetStateBits( DWORD grfStateBits, DWORD grfMask ); HRESULT Stat( STATSTG *pstatstg, DWORD grfStatFlag ); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OLEIDL.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OLEIDL.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OLEIDL.d Wed Mar 25 11:18:25 2009 +0100 @@ -7,9 +7,10 @@ // File: oadvhr.idl // //-------------------------------------------------------------------------- -private import org.eclipse.swt.internal.win32.WINTYPES; -private import org.eclipse.swt.internal.ole.win32.extras; -private import org.eclipse.swt.internal.ole.win32.OBJIDL; +import org.eclipse.swt.internal.win32.WINTYPES; +import org.eclipse.swt.internal.ole.win32.extras; +import org.eclipse.swt.internal.ole.win32.OBJIDL; +import org.eclipse.swt.internal.ole.win32.COMTYPES; //private import std.c.windows.windows; //private import std.c.windows.com; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/extras.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/extras.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/extras.d Wed Mar 25 11:18:25 2009 +0100 @@ -8,10 +8,7 @@ //public import std.c.windows.com; //public import std.c.windows.windows; import org.eclipse.swt.internal.win32.WINTYPES; -// private import org.eclipse.swt.internal.ole.win32.comtypes; -alias WCHAR OLECHAR; -alias OLECHAR *LPOLESTR; -alias OLECHAR *LPCOLESTR; +import org.eclipse.swt.internal.ole.win32.COMTYPES; enum { @@ -51,7 +48,10 @@ CLSCTX_SERVER = (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER), } -alias GUID IID; +version(Tango){ + static assert(0); + alias GUID IID; +} alias GUID CLSID; extern (C) @@ -159,6 +159,11 @@ extern IID IID_IEnumOLEVERB; } +version(D_Version2){ + mixin("alias const(IID) *REFCIID;"); +} else { // D1 + alias IID *REFCIID; +} extern (Windows) export { DWORD CoBuildVersion(); @@ -180,7 +185,7 @@ void CoFreeUnusedLibraries(); interface IUnknown { - HRESULT QueryInterface(IID* riid, void** pvObject); + HRESULT QueryInterface(REFCIID riid, void** pvObject); ULONG AddRef(); ULONG Release(); } @@ -203,6 +208,11 @@ //typedef GUID CLSID; //alias CLSID * LPCLSID; alias GUID *REFGUID; +version(D_Version2){ + mixin("alias const(GUID) *REFCGUID;"); +} else { // D1 + alias GUID *REFCGUID; +} //alias IID *REFIID; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/ifs.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/ifs.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/ifs.d Wed Mar 25 11:18:25 2009 +0100 @@ -55,7 +55,7 @@ { HRESULT GetLicInfo(LICINFO * pLicInfo); HRESULT RequestLicKey(DWORD dwReserved, BSTR * pbstrKey); - HRESULT CreateInstanceLic(LPUNKNOWN pUnkOuter, LPUNKNOWN pUnkReserved, REFIID riid, BSTR bstrKey, void ** ppvObject); + HRESULT CreateInstanceLic(LPUNKNOWN pUnkOuter, LPUNKNOWN pUnkReserved, REFCIID riid, BSTR bstrKey, void ** ppvObject); } alias IClassFactory2 LPCLASSFACTORY2; @@ -74,7 +74,7 @@ interface IConnectionPointContainer : IUnknown { HRESULT EnumConnectionPoints(LPENUMCONNECTIONPOINTS * ppEnum); - HRESULT FindConnectionPoint(REFIID riid, LPCONNECTIONPOINT * ppCP); + HRESULT FindConnectionPoint(REFCIID riid, LPCONNECTIONPOINT * ppCP); } alias IConnectionPointContainer LPCONNECTIONPOINTCONTAINER; @@ -209,7 +209,7 @@ } */ interface IServiceProvider : IUnknown { - HRESULT QueryService(REFGUID guidService, REFIID riid, void **ppv); + HRESULT QueryService(REFGUID guidService, REFCIID riid, void **ppv); } alias IServiceProvider LPSERVICEPROVIDER; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/OS.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/OS.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/OS.d Wed Mar 25 11:18:25 2009 +0100 @@ -83,23 +83,27 @@ public class OS : C { struct Symbol { - char[] name; + String name; void** symbol; int major; int minor; } - static void loadLib( Symbol[] symbols, char[] libname ){ - if (auto lib = tango.sys.SharedLib.SharedLib.load(libname)) { - foreach( inout s; symbols ){ - if( OS.WIN32_VERSION >= OS.VERSION( s.major, s.minor )){ - *s.symbol = lib.getSymbol( s.name.ptr ); - if( s.symbol is null ){ - getDwtLogger.error( __FILE__, __LINE__, "{}: Symbol '{}' not found", libname, s.name ); + static void loadLib( Symbol[] symbols, String libname ){ + version(Tango){ + if (auto lib = tango.sys.SharedLib.SharedLib.load(libname)) { + foreach( inout s; symbols ){ + if( OS.WIN32_VERSION >= OS.VERSION( s.major, s.minor )){ + *s.symbol = lib.getSymbol( s.name.ptr ); + if( s.symbol is null ){ + getDwtLogger.error( __FILE__, __LINE__, "{}: Symbol '{}' not found", libname, s.name ); + } } } + } else { + getDwtLogger.error( __FILE__, __LINE__, "Could not load the library {}", libname ); } - } else { - getDwtLogger.error( __FILE__, __LINE__, "Could not load the library {}", libname ); + } else { // Phobos + implMissing( __FILE__, __LINE__ ); } } @@ -368,15 +372,19 @@ //PORTING_CHANGE: comctl is loaded automatically //TCHAR lpLibFileName = new TCHAR (0, "comctl32.dll", true); //$NON-NLS-1$ //int /*long*/ hModule = OS.LoadLibrary (lpLibFileName); - if (auto lib = tango.sys.SharedLib.SharedLib.load( `comctl32.dll`) ) { - char[] name = "DllGetVersion\0"; //$NON-NLS-1$ - void* DllGetVersion = lib.getSymbol(name.ptr); - if (DllGetVersion !is null){ - alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion; - TDllVersion f = cast( TDllVersion )DllGetVersion; - f(&dvi); + version(Tango){ + if (auto lib = tango.sys.SharedLib.SharedLib.load( `comctl32.dll`) ) { + char[] name = "DllGetVersion\0"; //$NON-NLS-1$ + void* DllGetVersion = lib.getSymbol(name.ptr); + if (DllGetVersion !is null){ + alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion; + TDllVersion f = cast( TDllVersion )DllGetVersion; + f(&dvi); + } + lib.unload(); } - lib.unload(); + } else { // Phobos + implMissing( __FILE__, __LINE__ ); } COMCTL32_MAJOR = dvi.dwMajorVersion; COMCTL32_MINOR = dvi.dwMinorVersion; @@ -388,15 +396,19 @@ dvi.dwMajorVersion = 4; //TCHAR lpLibFileName = new TCHAR (0, "Shell32.dll", true); //$NON-NLS-1$ //int /*long*/ hModule = OS.LoadLibrary (lpLibFileName); - if ( auto lib = tango.sys.SharedLib.SharedLib.load( `Shell32.dll`)) { - char[] name = "DllGetVersion\0"; //$NON-NLS-1$ - void* DllGetVersion = lib.getSymbol(name.ptr); - if (DllGetVersion !is null){ - alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion; - TDllVersion f = cast( TDllVersion )DllGetVersion; - f(&dvi); + version(Tango){ + if ( auto lib = tango.sys.SharedLib.SharedLib.load( `Shell32.dll`)) { + char[] name = "DllGetVersion\0"; //$NON-NLS-1$ + void* DllGetVersion = lib.getSymbol(name.ptr); + if (DllGetVersion !is null){ + alias extern(Windows) void function(DLLVERSIONINFO*) TDllVersion; + TDllVersion f = cast( TDllVersion )DllGetVersion; + f(&dvi); + } + lib.unload(); } - lib.unload(); + } else { // Phobos + implMissing( __FILE__, __LINE__ ); } SHELL32_MAJOR = dvi.dwMajorVersion; SHELL32_MINOR = dvi.dwMinorVersion; @@ -408,10 +420,14 @@ **************************************************************************/ public static void enableVisualStyles() { - void printError( char[] msg ){ - char[] winMsg = tango.sys.Common.SysError.lastMsg(); - char[2000] buf; - getDwtLogger.error( __FILE__, __LINE__, "{}: {}", msg, CodePage.from( winMsg, buf ) ); + void printError( String msg ){ + version(Tango){ + char[] winMsg = tango.sys.Common.SysError.lastMsg(); + char[2000] buf; + getDwtLogger.error( __FILE__, __LINE__, "{}: {}", msg, CodePage.from( winMsg, buf ) ); + } else { // Phobos + implMissing( __FILE__, __LINE__ ); + } } TCHAR[] buffer = new TCHAR[ MAX_PATH ]; buffer[] = 0; @@ -2714,17 +2730,21 @@ ]; static void loadLib_UxTheme(){ - if (auto lib = tango.sys.SharedLib.SharedLib.load(`uxtheme.dll`)) { - foreach( inout s; Symbols_UxTheme ){ - if( OS.WIN32_VERSION >= OS.VERSION( s.major, s.minor )){ - *s.symbol = lib.getSymbol( s.name.ptr ); - if( *s.symbol is null ){ - getDwtLogger.error( __FILE__, __LINE__, "UxTheme.dll: Symbol '{}' not found", s.name ); + version(Tango){ + if (auto lib = tango.sys.SharedLib.SharedLib.load(`uxtheme.dll`)) { + foreach( inout s; Symbols_UxTheme ){ + if( OS.WIN32_VERSION >= OS.VERSION( s.major, s.minor )){ + *s.symbol = lib.getSymbol( s.name.ptr ); + if( *s.symbol is null ){ + getDwtLogger.error( __FILE__, __LINE__, "UxTheme.dll: Symbol '{}' not found", s.name ); + } } } + } else { + getDwtLogger.error( __FILE__, __LINE__, "Could not load the library UxTheme.dll"); } - } else { - getDwtLogger.error( __FILE__, __LINE__, "Could not load the library UxTheme.dll"); + } else { // Phobos + implMissing( __FILE__, __LINE__ ); } } //---------------------------------------------------------------------- @@ -3407,14 +3427,14 @@ // return WINAPI.DrawText(hDC, lpString, length, lpRect, uFormat); //} -static int GetProfileString(char[] lpAppName, char[] lpKeyName, char[] lpDefault, out char[] lpReturnedString, int nSize ){ +static int GetProfileString(String lpAppName, String lpKeyName, String lpDefault, out String lpReturnedString, int nSize ){ TCHAR[] buffer = new TCHAR[nSize]; int result = _GetProfileString(.StrToTCHARz(lpAppName), .StrToTCHARz(lpKeyName), .StrToTCHARz(lpDefault), buffer.ptr, nSize); lpReturnedString = .TCHARzToStr(buffer.ptr); return result; } -static char[] GetWindowText(HWND hwnd){ +static String GetWindowText(HWND hwnd){ assert(hwnd); int len = GetWindowTextLength(hwnd); if(len > 0){ @@ -3598,7 +3618,11 @@ return cast(bool) SendMessage( hwnd, TVM_GETITEMRECT, code, cast(int)prc ); } static int strlen( PCHAR ptr ){ - return tango.stdc.string.strlen( cast(char*)ptr ); + version(Tango){ + return tango.stdc.string.strlen( cast(char*)ptr ); + } else { // Phobos + implMissing( __FILE__, __LINE__ ); + } } static void POINTSTOPOINT( inout POINT pt, int pts) { @@ -3611,7 +3635,7 @@ //----------------------------------------------------------------------------- // convert UTF-8 to MBCS alias StrToMBCS StrToMBCSs; -public CHAR[] StrToMBCS(char[] sc, uint codepage = 0) { +public CHAR[] StrToMBCS(CString sc, uint codepage = 0) { CHAR[] ret = cast(CHAR[]) sc; try{ foreach (char c; sc){ @@ -3634,7 +3658,7 @@ } // convert UTF-8 to MBCSz -public char* StrToMBCSz(char[] sc) { +public char* StrToMBCSz(CString sc) { char* ret = null; try{ if( CodePage.isAscii( sc )){ @@ -3642,7 +3666,11 @@ } char[] dst; dst.length = sc.length; - return toStringz( tango.sys.win32.CodePage.CodePage.into( sc, dst )); + version(Tango){ + return toStringz( tango.sys.win32.CodePage.CodePage.into( sc, dst )); + } else { // Phobos + implMissing( __FILE__, __LINE__ ); + } }catch(Exception e){ // do nothing ret = ""; @@ -3651,10 +3679,10 @@ return ret; } -public wchar[] StrToWCHARs(uint codepage , char[] sc, bool terminated = false ) { +public String16 StrToWCHARs(uint codepage , CString sc, bool terminated = false ) { return StrToWCHARs( sc, terminated ); } -public wchar[] StrToWCHARs(char[] sc, bool terminated = false ) { +public String16 StrToWCHARs(CString sc, bool terminated = false ) { wchar[] ret; try{ ret = toWCharArray(sc); @@ -3668,19 +3696,19 @@ return ret; } -public wchar* StrToWCHARz( uint codepage, char[] sc, uint* length = null ) { +public wchar* StrToWCHARz( uint codepage, CString sc, uint* length = null ) { return StrToWCHARz( sc, length ); } -public wchar* StrToWCHARz(char[] sc, uint* length = null ) { +public wchar* StrToWCHARz(CString sc, uint* length = null ) { return StrToWCHARs(sc, true ).ptr; } -public char[] MBCSsToStr(CHAR[] string, uint codepage = 0){ +public CString MBCSsToStr(CHAR[] string, uint codepage = 0){ return MBCSzToStr( string.ptr, string.length, codepage); } -public char[] MBCSzToStr(PCHAR pString, int _length = -1, uint codepage = 0) { +public CString MBCSzToStr(PCHAR pString, int _length = -1, uint codepage = 0) { // null terminated string pointer if(_length == -1){ _length = 0; @@ -3700,11 +3728,11 @@ return result; } -public char[] WCHARsToStr(wchar[] string){ +public String WCHARsToStr(CString16 string){ return WCHARzToStr(string.ptr, string.length); } -public char[] WCHARzToStr(wchar* pString, int _length = -1) +public String WCHARzToStr(LPCWSTR pString, int _length = -1) { if( pString is null ){ return null; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINAPI.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINAPI.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINAPI.d Wed Mar 25 11:18:25 2009 +0100 @@ -1806,7 +1806,7 @@ int nHeightSrc, // height of source rectangle UINT crTransparent // color to make transparent ); -int IIDFromString (wchar* lpsz, byte* lpiid); +int IIDFromString (LPCWSTR lpsz, byte* lpiid); HRESULT ScriptJustify( SCRIPT_VISATTR* psva, int* piAdvance, @@ -3379,9 +3379,9 @@ //alias STDWIN.RoundRect RoundRect; // basic -void RtlMoveMemory(void* Destination, void* Source, DWORD Length); +void RtlMoveMemory(void* Destination, LPCVOID Source, DWORD Length); // extends -void RtlMoveMemory(int Destination, void* Source, DWORD Length); +void RtlMoveMemory(int Destination, LPCVOID Source, DWORD Length); void RtlMoveMemory(void* Destination, int Source, DWORD Length); void RtlMoveMemory(int Destination, int Source, DWORD Length); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINTYPES.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINTYPES.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINTYPES.d Wed Mar 25 11:18:25 2009 +0100 @@ -9,6 +9,7 @@ } else { // Phobos // public import std.c.windows.windows; } +import java.lang.all; // missing in tango //alias TLOGFONTA* LPLOGFONTA; @@ -31,7 +32,13 @@ alias WINBOOL BOOL; alias uint CALTYPE; alias uint CALID; - alias char CCHAR; + version(D_Version2){ + mixin("alias const(char) CCHAR;"); + mixin("alias const(wchar) CWCHAR;"); + } else { // D1 + alias char CCHAR; + alias wchar CWCHAR; + } alias char* PCHAR; alias uint COLORREF; alias uint TCOLORREF; @@ -110,13 +117,22 @@ alias ushort* LP; alias WINBOOL* LPBOOL; alias ubyte* LPBYTE; - alias PCHAR LPCCH; - alias PCHAR LPCH; alias COLORREF* LPCOLORREF; - alias PCHAR LPCSTR; - alias TCHAR* LPCTSTR; - alias wchar* LPCWCH; - alias wchar* LPCWSTR; + version(D_Version2){ + mixin( "alias const(char)* LPCCH;"); + mixin( "alias const(char)* LPCH;"); + mixin( "alias const(char)* LPCSTR;"); + mixin( "alias const(TCHAR)* LPCTSTR;"); + mixin( "alias const(wchar)* LPCWCH;"); + mixin( "alias const(wchar)* LPCWSTR;"); + } else { + alias PCHAR LPCCH; + alias PCHAR LPCH; + alias PCHAR LPCSTR; + alias TCHAR* LPCTSTR; + alias wchar* LPCWCH; + alias wchar* LPCWSTR; + } alias DWORD* LPDWORD; alias HANDLE* LPHANDLE; alias int* LPINT; @@ -126,7 +142,11 @@ alias TCHAR* LPTSTR; alias int LRESULT; alias POINTER LPVOID; - alias POINTER LPCVOID; + version(D_Version2){ + mixin( "alias const(void)* LPCVOID;"); + } else { + alias POINTER LPCVOID; + } alias wchar* LPWCH; alias wchar* LPWORD; alias wchar* LPWSTR; @@ -174,8 +194,10 @@ // fills code with so many casts that it's just not sensible. // (See also DMD Issue 2193.) alias char TCHAR; + alias String StringT; }else{ alias wchar TCHAR; + alias String16 StringT; } alias ubyte BCHAR; @@ -191,7 +213,7 @@ alias IID* REFIID; // Cast a string literal to a ubyte*=PCHAR - template _PCHAR( char[] a ){ + template _PCHAR( String a ){ const PCHAR _PCHAR = cast(PCHAR)a.ptr; } diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/layout/GridData.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/layout/GridData.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/layout/GridData.d Wed Mar 25 11:18:25 2009 +0100 @@ -546,7 +546,7 @@ default: vAlign = "Undefined "~String_valueOf(verticalAlignment); break; } String string = getName()~" {"; - string ~= "horizontalAlignment="~String_valueOf(hAlign)~" "; + string ~= "horizontalAlignment="~hAlign~" "; if (horizontalIndent !is 0) string ~= "horizontalIndent="~String_valueOf(horizontalIndent)~" "; if (horizontalSpan !is 1) string ~= "horizontalSpan="~String_valueOf(horizontalSpan)~" "; if (grabExcessHorizontalSpace) string ~= "grabExcessHorizontalSpace="~String_valueOf(grabExcessHorizontalSpace)~" "; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OLE.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OLE.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OLE.d Wed Mar 25 11:18:25 2009 +0100 @@ -384,23 +384,23 @@ if (extension.charAt (0) !is '.') extension = "." ~ extension; //$NON-NLS-1$ /* Use the character encoding for the default locale */ - TCHAR[] extensionKey = StrToTCHARs(0, extension, true); + StringT extensionKey = StrToTCHARs(0, extension, true); String result = getKeyValue(extensionKey); if (result !is null) { // look for "\NotInsertable" - TCHAR[] notInsertableKey = StrToTCHARs(0, result~"\\NotInsertable", true); //$NON-NLS-1$ + StringT notInsertableKey = StrToTCHARs(0, result~"\\NotInsertable", true); //$NON-NLS-1$ if (getKeyExists(notInsertableKey)) return ""; //$NON-NLS-1$ // look for "\Insertable" - TCHAR[] insertableKey = StrToTCHARs(0, result~"\\Insertable", true); //$NON-NLS-1$ + StringT insertableKey = StrToTCHARs(0, result~"\\Insertable", true); //$NON-NLS-1$ if (getKeyExists(insertableKey)) return result; // look for "\protocol\StdFileEditing\server" - TCHAR[] serverKey = StrToTCHARs(0, result~"\\protocol\\StdFileEditing\\server", true); //$NON-NLS-1$ + StringT serverKey = StrToTCHARs(0, result~"\\protocol\\StdFileEditing\\server", true); //$NON-NLS-1$ if (getKeyExists(serverKey)) return result; } return ""; //$NON-NLS-1$ } -static String getKeyValue (TCHAR[] key) { +static String getKeyValue (StringT key) { void* [1] phkResult; if (OS.RegOpenKeyEx (cast(void*)OS.HKEY_CLASSES_ROOT, key.ptr, 0, OS.KEY_READ, phkResult.ptr) !is 0) { return null; @@ -423,7 +423,7 @@ if (phkResult [0] !is null) OS.RegCloseKey (phkResult [0]); return result; } -private static bool getKeyExists (TCHAR[] key) { +private static bool getKeyExists (StringT key) { void* [1] phkResult; if (OS.RegOpenKeyEx (cast(void*)OS.HKEY_CLASSES_ROOT, key.ptr, 0, OS.KEY_READ, phkResult.ptr) !is 0) { return false; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OleClientSite.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OleClientSite.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OleClientSite.d Wed Mar 25 11:18:25 2009 +0100 @@ -357,7 +357,7 @@ // its primary stream wchar* streamName = StrToWCHARz("CONTENTS"); //$NON-NLS-1$ GUID* wordGUID = getClassID(WORDPROGID); - if (wordGUID !is null && COM.IsEqualGUID(appClsid, wordGUID)) streamName = "WordDocument"; //$NON-NLS-1$ + if (wordGUID !is null && COM.IsEqualGUID(appClsid, wordGUID)) streamName = StrToWCHARz("WordDocument"); //$NON-NLS-1$ IStream stream; result = storage.CreateStream(streamName, mode, 0, 0, &stream); // Increments ref count if successful if (result !is COM.S_OK) { diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OleControlSite.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OleControlSite.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OleControlSite.d Wed Mar 25 11:18:25 2009 +0100 @@ -285,7 +285,7 @@ if (listener is null || automation is null || eventSinkId is null) OLE.error (__FILE__, __LINE__, SWT.ERROR_NULL_ARGUMENT); auto address = automation.getAddress(); if (address is null) return; - wchar[] buffer = StrToWCHARs(0,eventSinkId,true); + String16 buffer = StrToWCHARs(0,eventSinkId,true); GUID* guid = new GUID(); if (COM.IIDFromString(buffer.ptr, guid) !is COM.S_OK) return; addEventListener(address, guid, eventID, listener); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/Variant.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/Variant.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/Variant.d Wed Mar 25 11:18:25 2009 +0100 @@ -538,7 +538,7 @@ break; case COM.VT_BSTR : COM.MoveMemory((cast(void*)pData), &type, 2); - wchar[] data = StrToWCHARs(stringData); + StringT data = StrToWCHARs(stringData); auto ptr = COM.SysAllocString(data.ptr); COM.MoveMemory((cast(void*)pData) + 8, &ptr, 4); break; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/printing/Printer.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/printing/Printer.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/printing/Printer.d Wed Mar 25 11:18:25 2009 +0100 @@ -76,9 +76,9 @@ /** * strings used to access the Windows registry */ - static TCHAR[] profile; - static TCHAR[] appName; - static TCHAR[] keyName; + static StringT profile; + static StringT appName; + static StringT keyName; static this() { profile = StrToTCHARs(0, "PrinterPorts", true); //$NON-NLS-1$ appName = StrToTCHARs(0, "windows", true); //$NON-NLS-1$ @@ -107,7 +107,7 @@ System.arraycopy(deviceNames, 0, newNames, 0, deviceNames.length); deviceNames = newNames; } - deviceNames[nameCount] = buf[index .. i ].dup; + deviceNames[nameCount] = buf[index .. i ].idup; nameCount++; index = i + 1; } @@ -120,7 +120,7 @@ int commaIndex = 0; while (buf[commaIndex] !is ',' && commaIndex < length) commaIndex++; if (commaIndex < length) { - driver = buf[0 .. commaIndex].dup; + driver = buf[0 .. commaIndex].idup; } } printerList[p] = new PrinterData(driver, device); @@ -147,14 +147,14 @@ int commaIndex = 0; while(buf[commaIndex] !is ',' && commaIndex < length) commaIndex++; if (commaIndex < length) { - deviceName = buf[0 .. commaIndex].dup; + deviceName = buf[0 .. commaIndex].idup; } String driver = ""; //$NON-NLS-1$ if (OS.GetProfileString(TCHARsToStr(profile), deviceName, null, buf, length) > 0) { commaIndex = 0; while (buf[commaIndex] !is ',' && commaIndex < length) commaIndex++; if (commaIndex < length) { - driver = buf[0 .. commaIndex].dup; + driver = buf[0 .. commaIndex].idup; } } return new PrinterData(driver, deviceName); @@ -218,8 +218,8 @@ protected void create(DeviceData deviceData) { data = cast(PrinterData)deviceData; /* Use the character encoding for the default locale */ - TCHAR[] driver = StrToTCHARs(0, data.driver, true); - TCHAR[] device = StrToTCHARs(0, data.name, true); + StringT driver = StrToTCHARs(0, data.driver, true); + StringT device = StrToTCHARs(0, data.name, true); DEVMODE* lpInitData; byte buffer [] = data.otherData; auto hHeap = OS.GetProcessHeap(); @@ -309,7 +309,7 @@ TCHAR* lpszDocName; if (jobName !is null && jobName.length !is 0) { /* Use the character encoding for the default locale */ - TCHAR[] buffer = StrToTCHARs(0, jobName, true); + StringT buffer = StrToTCHARs(0, jobName, true); int byteCount = buffer.length * TCHAR.sizeof; lpszDocName = cast(TCHAR*) OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory(lpszDocName, buffer.ptr, byteCount); @@ -318,7 +318,7 @@ TCHAR* lpszOutput; if (data.printToFile && data.fileName !is null) { /* Use the character encoding for the default locale */ - TCHAR[] buffer = StrToTCHARs(0, data.fileName, true); + StringT buffer = StrToTCHARs(0, data.fileName, true); int byteCount = buffer.length * TCHAR.sizeof; lpszOutput = cast(TCHAR*) OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory(lpszOutput, buffer.ptr, byteCount); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/program/Program.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/program/Program.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/program/Program.d Wed Mar 25 11:18:25 2009 +0100 @@ -40,7 +40,7 @@ this () { } -static String assocQueryString (int assocStr, TCHAR[] key, bool expand) { +static String assocQueryString (int assocStr, StringT key, bool expand) { TCHAR[] pszOut = NewTCHARs(0, 1024); uint[1] pcchOut; pcchOut[0] = pszOut.length; @@ -83,7 +83,7 @@ if (extension.length is 0) return null; if (extension.charAt (0) !is '.') extension = "." ~ extension; //$NON-NLS-1$ /* Use the character encoding for the default locale */ - TCHAR[] key = StrToTCHARs (0, extension, true); + StringT key = StrToTCHARs (0, extension, true); Program program = null; if (OS.IsWinCE) { void*[1] phkResult; @@ -154,7 +154,7 @@ static String getKeyValue (String string, bool expand) { /* Use the character encoding for the default locale */ - TCHAR[] key = StrToTCHARs (0, string, true); + StringT key = StrToTCHARs (0, string, true); void* [1] phkResult; if (OS.RegOpenKeyEx (cast(void*)OS.HKEY_CLASSES_ROOT, key.ptr, 0, OS.KEY_READ, phkResult.ptr) !is 0) { return null; @@ -270,7 +270,7 @@ /* Use the character encoding for the default locale */ auto hHeap = OS.GetProcessHeap (); - TCHAR[] buffer = StrToTCHARs (0, fileName, true); + StringT buffer = StrToTCHARs (0, fileName, true); int byteCount = buffer.length * TCHAR.sizeof; auto lpFile = cast(wchar*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (lpFile, buffer.ptr, byteCount); @@ -315,7 +315,7 @@ String commandLine = prefix ~ fileName ~ suffix; auto hHeap = OS.GetProcessHeap (); /* Use the character encoding for the default locale */ - TCHAR[] buffer = StrToTCHARs (0, commandLine, true); + StringT buffer = StrToTCHARs (0, commandLine, true); int byteCount = buffer.length * TCHAR.sizeof; auto lpCommandLine = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (lpCommandLine, buffer.ptr, byteCount); @@ -340,7 +340,7 @@ if (extension !is null) { SHFILEINFOW shfi; int flags = OS.SHGFI_ICON | OS.SHGFI_SMALLICON | OS.SHGFI_USEFILEATTRIBUTES; - TCHAR[] pszPath = StrToTCHARs (0, extension, true); + StringT pszPath = StrToTCHARs (0, extension, true); OS.SHGetFileInfo (pszPath.ptr, OS.FILE_ATTRIBUTE_NORMAL, &shfi, SHFILEINFO.sizeof, flags); if (shfi.hIcon !is null) { Image image = Image.win32_new (null, SWT.ICON, shfi.hIcon); @@ -366,7 +366,7 @@ } } /* Use the character encoding for the default locale */ - TCHAR[] lpszFile = StrToTCHARs (0, fileName, true); + StringT lpszFile = StrToTCHARs (0, fileName, true); HICON [1] phiconSmall, phiconLarge; OS.ExtractIconEx (lpszFile.ptr, nIconIndex, phiconLarge.ptr, phiconSmall.ptr, 1); if (phiconSmall [0] is null) return null; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Combo.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Combo.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Combo.d Wed Mar 25 11:18:25 2009 +0100 @@ -189,7 +189,7 @@ // SWT extension: allow null string //if (string is null) error (SWT.ERROR_NULL_ARGUMENT); auto buffer = StrToTCHARs( getCodePage(), string, true ); - int result = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer.ptr ); + int result = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, cast(void*)buffer.ptr ); if (result is OS.CB_ERR) error (SWT.ERROR_ITEM_NOT_ADDED); if (result is OS.CB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED); if ((style & SWT.H_SCROLL) !is 0) setScrollWidth (buffer, true); @@ -226,7 +226,7 @@ error (SWT.ERROR_INVALID_RANGE); } auto buffer = StrToTCHARs( getCodePage(), string, true ); - int result = OS.SendMessage (handle, OS.CB_INSERTSTRING, index, buffer.ptr); + int result = OS.SendMessage (handle, OS.CB_INSERTSTRING, index, cast(void*)buffer.ptr); if (result is OS.CB_ERRSPACE || result is OS.CB_ERR) { error (SWT.ERROR_ITEM_NOT_ADDED); } @@ -1121,7 +1121,7 @@ if (0 <= index && index < count) error (SWT.ERROR_ITEM_NOT_REMOVED); error (SWT.ERROR_INVALID_RANGE); } - if ((style & SWT.H_SCROLL) !is 0) setScrollWidth (buffer, true); + if ((style & SWT.H_SCROLL) !is 0) setScrollWidth (cast(StringT)buffer, true); if (notify && length_ !is OS.GetWindowTextLength (handle)) { sendEvent (SWT.Modify); if (isDisposed ()) return; @@ -1736,7 +1736,7 @@ } } -void setScrollWidth (TCHAR[] buffer, bool grow) { +void setScrollWidth (StringT buffer, bool grow) { RECT rect; HFONT newFont, oldFont; auto hDC = OS.GetDC (handle); @@ -2389,7 +2389,7 @@ OS.CallWindowProc (EditProc, hwndText, msg, wParam, lParam); } if (msg is OS.WM_SETTEXT) { - TCHAR[] buffer = StrToTCHARs( getCodePage(), newText, true ); + StringT buffer = StrToTCHARs( getCodePage(), newText, true ); auto hHeap = OS.GetProcessHeap (); int byteCount = buffer.length * TCHAR.sizeof; auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Control.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Control.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Control.d Wed Mar 25 11:18:25 2009 +0100 @@ -55,7 +55,10 @@ import java.lang.all; import java.lang.System; -static import tango.sys.Common; +version(Tango){ + //static import tango.sys.Common; +} else { // Phobos +} /** * Control is the abstract superclass of all windowed user interface classes. diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/DateTime.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/DateTime.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/DateTime.d Wed Mar 25 11:18:25 2009 +0100 @@ -201,8 +201,8 @@ super (parent, checkStyle (style)); if ((this.style & SWT.SHORT) !is 0) { String buffer = ((this.style & SWT.DATE) !is 0) ? getCustomShortDateFormat() : getCustomShortTimeFormat(); - TCHAR[] lpszFormat = StrToTCHARs (0, buffer, true); - OS.SendMessage (handle, OS.DTM_SETFORMAT, 0, lpszFormat.ptr); + StringT lpszFormat = StrToTCHARs (0, buffer, true); + OS.SendMessage (handle, OS.DTM_SETFORMAT, 0, cast(void*)lpszFormat.ptr); } } diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Decorations.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Decorations.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Decorations.d Wed Mar 25 11:18:25 2009 +0100 @@ -1339,7 +1339,7 @@ // SWT extension: allow null string //if (string is null) error (SWT.ERROR_NULL_ARGUMENT); /* Use the character encoding for the default locale */ - TCHAR[] buffer = StrToTCHARs (string, true); + StringT buffer = StrToTCHARs (string, true); /* Ensure that the title appears in the task bar.*/ if ((state & FOREIGN_HANDLE) !is 0) { auto hHeap = OS.GetProcessHeap (); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/DirectoryDialog.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/DirectoryDialog.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/DirectoryDialog.d Wed Mar 25 11:18:25 2009 +0100 @@ -99,12 +99,12 @@ case OS.BFFM_INITIALIZED: if (pThis.filterPath !is null && pThis.filterPath.length !is 0) { /* Use the character encoding for the default locale */ - TCHAR[] buffer = StrToTCHARs (0, pThis.filterPath.replace ('/', '\\'), true); - OS.SendMessage (hwnd, OS.BFFM_SETSELECTION, 1, buffer.ptr); + StringT buffer = StrToTCHARs (0, pThis.filterPath.replace ('/', '\\'), true); + OS.SendMessage (hwnd, OS.BFFM_SETSELECTION, 1, cast(void*)buffer.ptr); } if (pThis.title !is null && pThis.title.length !is 0) { /* Use the character encoding for the default locale */ - TCHAR[] buffer = StrToTCHARs (0, pThis.title, true); + StringT buffer = StrToTCHARs (0, pThis.title, true); OS.SetWindowText (hwnd, buffer.ptr); } break; @@ -183,7 +183,7 @@ // string = new String (buffer, 0, index); } /* Use the character encoding for the default locale */ - TCHAR[] buffer = StrToTCHARs (0, string, true); + StringT buffer = StrToTCHARs (0, string, true); int byteCount = buffer.length * TCHAR.sizeof; lpszTitle = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (lpszTitle, buffer.ptr, byteCount); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Display.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Display.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Display.d Wed Mar 25 11:18:25 2009 +0100 @@ -147,7 +147,7 @@ //Callback windowCallback; //int windowProc_; int threadId; - TCHAR[] windowClass_, windowShadowClass; + StringT windowClass_, windowShadowClass; static int WindowClassCount; static const String WindowName = "SWT_Window"; //$NON-NLS-1$ static const String WindowShadowName = "SWT_WindowShadow"; //$NON-NLS-1$ @@ -2610,20 +2610,22 @@ } +/ int byteCount = windowClass_.length * TCHAR.sizeof; - lpWndClass.lpszClassName = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - OS.MoveMemory (lpWndClass.lpszClassName, windowClass_.ptr, byteCount); + auto buf = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); + lpWndClass.lpszClassName = buf; + OS.MoveMemory (buf, windowClass_.ptr, byteCount); OS.RegisterClass (&lpWndClass); - OS.HeapFree (hHeap, 0, lpWndClass.lpszClassName); + OS.HeapFree (hHeap, 0, buf); /* Register the SWT drop shadow window class */ if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) { lpWndClass.style |= OS.CS_DROPSHADOW; } byteCount = windowShadowClass.length * TCHAR.sizeof; - lpWndClass.lpszClassName = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - OS.MoveMemory (lpWndClass.lpszClassName, windowShadowClass.ptr, byteCount); + buf = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); + lpWndClass.lpszClassName = buf; + OS.MoveMemory (buf, windowShadowClass.ptr, byteCount); OS.RegisterClass (&lpWndClass); - OS.HeapFree (hHeap, 0, lpWndClass.lpszClassName); + OS.HeapFree (hHeap, 0, buf); /* Create the message only HWND */ hwndMessage = OS.CreateWindowEx (0, diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/ExpandItem.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/ExpandItem.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/ExpandItem.d Wed Mar 25 11:18:25 2009 +0100 @@ -213,7 +213,7 @@ } if (text.length > 0) { rect.left += ExpandItem.TEXT_INSET; - TCHAR[] buffer = StrToTCHARs ( text/+, parent.getCodePage ()+/ ); + auto buffer = StrToTCHARs ( text/+, parent.getCodePage ()+/ ); if (hTheme !is null) { OS.DrawThemeText (hTheme, hDC, OS.EBP_NORMALGROUPHEAD, 0, buffer.ptr, buffer.length, OS.DT_VCENTER | OS.DT_SINGLELINE, 0, &rect); } else { @@ -342,7 +342,7 @@ } if (text.length > 0) { RECT rect; - TCHAR[] buffer = StrToTCHARs (/+parent.getCodePage (),+/ text); + auto buffer = StrToTCHARs (/+parent.getCodePage (),+/ text); if (hTheme !is null) { OS.GetThemeTextExtent (hTheme, hDC, OS.EBP_NORMALGROUPHEAD, 0, buffer.ptr, buffer.length, OS.DT_SINGLELINE, null, &rect); } else { diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/FileDialog.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/FileDialog.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/FileDialog.d Wed Mar 25 11:18:25 2009 +0100 @@ -278,7 +278,7 @@ /* Convert the title and copy it into lpstrTitle */ if (title is null) title = ""; /* Use the character encoding for the default locale */ - TCHAR[] buffer3 = StrToTCHARs (0, title, true); + auto buffer3 = StrToTCHARs (0, title, true); int byteCount3 = buffer3.length * TCHAR.sizeof; auto lpstrTitle = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount3); OS.MoveMemory (lpstrTitle, buffer3.ptr, byteCount3); @@ -296,7 +296,7 @@ strFilter = strFilter ~ FILTER ~ '\0' ~ FILTER ~ '\0'; } /* Use the character encoding for the default locale */ - TCHAR[] buffer4 = StrToTCHARs (0, strFilter, true); + auto buffer4 = StrToTCHARs (0, strFilter, true); int byteCount4 = buffer4.length * TCHAR.sizeof; auto lpstrFilter = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount4); OS.MoveMemory (lpstrFilter, buffer4.ptr, byteCount4); @@ -304,7 +304,7 @@ /* Convert the fileName and filterName to C strings */ if (fileName is null) fileName = ""; /* Use the character encoding for the default locale */ - TCHAR[] name = StrToTCHARs (0, fileName, true); + auto name = StrToTCHARs (0, fileName, true); /* * Copy the name into lpstrFile and ensure that the @@ -323,7 +323,7 @@ */ if (filterPath is null) filterPath = ""; /* Use the character encoding for the default locale */ - TCHAR[] path = StrToTCHARs (0, filterPath.replace ('/', '\\'), true); + auto path = StrToTCHARs (0, filterPath.replace ('/', '\\'), true); int byteCount5 = OS.MAX_PATH * TCHAR.sizeof; auto lpstrInitialDir = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount5); int byteCountDir = Math.min (path.length * TCHAR.sizeof, byteCount5 - TCHAR.sizeof); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Group.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Group.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Group.d Wed Mar 25 11:18:25 2009 +0100 @@ -91,7 +91,7 @@ OS.GetClassInfo (null, GroupClass.ptr, &lpWndClass); GroupProc = lpWndClass.lpfnWndProc; } else { - TCHAR[] WC_BUTTON = "BUTTON\0"; + StringT WC_BUTTON = "BUTTON\0"; OS.GetClassInfo (null, WC_BUTTON.ptr, &lpWndClass); GroupProc = lpWndClass.lpfnWndProc; auto hInstance = OS.GetModuleHandle (null); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Link.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Link.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Link.d Wed Mar 25 11:18:25 2009 +0100 @@ -225,7 +225,7 @@ auto newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); auto oldFont = OS.SelectObject (hDC, newFont); if (text.length > 0) { - TCHAR[] buffer = StrToTCHARs (getCodePage (), parse (text)); + StringT buffer = StrToTCHARs (getCodePage (), parse (text)); RECT rect; int flags = OS.DT_CALCRECT | OS.DT_NOPREFIX; if (wHint !is SWT.DEFAULT) { @@ -524,7 +524,7 @@ parseMnemonics (buffer, linkStart, endtagStart, result); offsets [linkIndex] = new Point (offset, result.length - 1); if (ids [linkIndex] is null) { - ids [linkIndex] = buffer[ linkStart .. endtagStart ].dup; + ids [linkIndex] = buffer[ linkStart .. endtagStart ].idup; } linkIndex++; start = tagStart = linkStart = endtagStart = refStart = index + 1; @@ -555,7 +555,7 @@ break; case 12: if (c is '"') { - ids[linkIndex] = buffer[ refStart .. index ].dup; + ids[linkIndex] = buffer[ refStart .. index ].idup; state = 2; } break; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Listener.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Listener.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Listener.d Wed Mar 25 11:18:25 2009 +0100 @@ -14,8 +14,13 @@ import org.eclipse.swt.widgets.Event; -import tango.core.Traits; -import tango.core.Tuple; +version(Tango){ + import tango.core.Traits; + import tango.core.Tuple; +} else { // Phobos + import std.traits; + import std.typetuple; +} /** * Implementers of Listener provide a simple @@ -61,9 +66,15 @@ /// Helper class for the dgListener template function private class _DgListenerT(Dg,T...) : Listener { - alias ParameterTupleOf!(Dg) DgArgs; - static assert( is(DgArgs == Tuple!(Event,T)), + version(Tango){ + alias ParameterTupleOf!(Dg) DgArgs; + static assert( is(DgArgs == Tuple!(CTabFolderEvent,T)), "Delegate args not correct: delegate args: ("~DgArgs.stringof~") vs. passed args: ("~Tuple!(Event,T).stringof~")" ); + } else { // Phobos + alias ParameterTypeTuple!(Dg) DgArgs; + static assert( is(DgArgs == TypeTuple!(CTabFolderEvent,T)), + "Delegate args not correct: delegate args: ("~DgArgs.stringof~") vs. passed args: ("~Tuple!(Event,T).stringof~")" ); + } Dg dg; T t; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Menu.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Menu.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Menu.d Wed Mar 25 11:18:25 2009 +0100 @@ -506,7 +506,7 @@ * space. */ auto hHeap = OS.GetProcessHeap (); - TCHAR[] buffer = StrToTCHARs (0, " \0"); + StringT buffer = StrToTCHARs (0, " \0"); int byteCount = (buffer.length-1) * TCHAR.sizeof; auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (pszText, buffer.ptr, byteCount); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/MenuItem.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/MenuItem.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/MenuItem.d Wed Mar 25 11:18:25 2009 +0100 @@ -915,7 +915,7 @@ uFlags |= OS.MF_POPUP; uIDNewItem = cast(int)menu.handle; } - TCHAR[] lpNewItem = StrToTCHARs (0, " ", true); + StringT lpNewItem = StrToTCHARs (0, " ", true); success = OS.InsertMenu (hMenu, index, uFlags, uIDNewItem, lpNewItem.ptr) !is 0; if (success) { info.fMask = OS.MIIM_DATA | OS.MIIM_TYPE; @@ -1066,10 +1066,10 @@ for (i=0; i index || index > count - 1) return; @@ -1197,7 +1197,7 @@ } if (strings !is null) { if (string==/*eq*/strings [index]) return; - strings [index] = string.dup; + strings [index] = string.idup; } if ((parent.style & SWT.VIRTUAL) !is 0) cached = true; if (index is 0) { diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Text.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Text.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Text.d Wed Mar 25 11:18:25 2009 +0100 @@ -1066,7 +1066,7 @@ HFONT newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX; - TCHAR[] SPACE = StrToTCHARs (getCodePage (), " ", false); + StringT SPACE = StrToTCHARs (getCodePage (), " ", false); OS.DrawText (hDC, SPACE.ptr, SPACE.length, &rect, flags); if (newFont !is null) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/ToolItem.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/ToolItem.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/ToolItem.d Wed Mar 25 11:18:25 2009 +0100 @@ -784,7 +784,7 @@ TCHAR* pszText; if (string.length !is 0) { info.fsStyle |= OS.BTNS_SHOWTEXT; - TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), string, true ); + StringT buffer = StrToTCHARs (parent.getCodePage (), string, true ); int byteCount = buffer.length * TCHAR.sizeof; pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (pszText, buffer.ptr, byteCount); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/ToolTip.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/ToolTip.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/ToolTip.d Wed Mar 25 11:18:25 2009 +0100 @@ -526,8 +526,8 @@ if (item !is null && OS.SHELL32_MAJOR >= 5) { if (visible) { NOTIFYICONDATA iconData; - TCHAR[] buffer1 = StrToTCHARs (0, text, true); - TCHAR[] buffer2 = StrToTCHARs (0, message, true); + StringT buffer1 = StrToTCHARs (0, text, true); + StringT buffer2 = StrToTCHARs (0, message, true); static if (OS.IsUnicode) { TCHAR [] szInfoTitle = iconData.szInfoTitle; int length1 = Math.min (szInfoTitle.length - 1, buffer1.length); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TrayItem.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TrayItem.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TrayItem.d Wed Mar 25 11:18:25 2009 +0100 @@ -471,7 +471,7 @@ checkWidget (); toolTipText = value; NOTIFYICONDATA iconData; - TCHAR[] buffer = StrToTCHARs (0, toolTipText is null ? "X"[1..1] : toolTipText, true); + StringT buffer = StrToTCHARs (0, toolTipText is null ? "X"[1..1] : toolTipText, true); assert( buffer.ptr !is null ); /* * Note that the size of the szTip field is different in version 5.0 of shell32.dll. diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Tree.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Tree.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Tree.d Wed Mar 25 11:18:25 2009 +0100 @@ -836,7 +836,7 @@ if ((column.style & SWT.CENTER) !is 0) flags |= OS.DT_CENTER; if ((column.style & SWT.RIGHT) !is 0) flags |= OS.DT_RIGHT; } - TCHAR[] buffer = StrToTCHARs (getCodePage (), string, false); + StringT buffer = StrToTCHARs (getCodePage (), string, false); if (!ignoreDrawForeground) OS.DrawText (hDC, buffer.ptr, buffer.length, rect, flags); OS.DrawText (hDC, buffer.ptr, buffer.length, rect, flags | OS.DT_CALCRECT); if (hFont !is cast(HFONT)-1) hFont = cast(HFONT)OS.SelectObject (hDC, hFont); @@ -7158,7 +7158,7 @@ if (strings !is null) string = strings [index]; } if (string !is null) { - TCHAR[] buffer = StrToTCHARs (getCodePage (), string, false); + StringT buffer = StrToTCHARs (getCodePage (), string, false); int byteCount = Math.min (buffer.length, lptvdi.item.cchTextMax - 1) * TCHAR.sizeof; OS.MoveMemory (lptvdi.item.pszText, buffer.ptr, byteCount); int st = byteCount/TCHAR.sizeof; @@ -7792,7 +7792,7 @@ if ((column.style & SWT.CENTER) !is 0) flags |= OS.DT_CENTER; if ((column.style & SWT.RIGHT) !is 0) flags |= OS.DT_RIGHT; } - TCHAR[] buffer = StrToTCHARs (getCodePage (), string, false); + StringT buffer = StrToTCHARs (getCodePage (), string, false); RECT textRect; OS.SetRect (&textRect, x, cellRect.top, cellRect.right, cellRect.bottom); OS.DrawText (nmcd.nmcd.hdc, buffer.ptr, buffer.length, &textRect, flags); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TreeColumn.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TreeColumn.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TreeColumn.d Wed Mar 25 11:18:25 2009 +0100 @@ -379,7 +379,7 @@ } RECT rect; int flags = OS.DT_CALCRECT | OS.DT_NOPREFIX; - TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), text, false); + StringT buffer = StrToTCHARs (parent.getCodePage (), text, false); OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags); int headerWidth = rect.right - rect.left + Tree.HEADER_MARGIN; if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) headerWidth += Tree.HEADER_EXTRA; @@ -676,7 +676,7 @@ * with spaces. */ auto hHeap = OS.GetProcessHeap (); - TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), fixMnemonic (string, true), true); + StringT buffer = StrToTCHARs (parent.getCodePage (), fixMnemonic (string, true), true); int byteCount = buffer.length * TCHAR.sizeof; auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (pszText, buffer.ptr, byteCount); diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TreeItem.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TreeItem.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TreeItem.d Wed Mar 25 11:18:25 2009 +0100 @@ -521,7 +521,7 @@ String string = index is 0 ? text : strings !is null ? strings [index] : null; if (string !is null) { RECT* textRect = new RECT(); - TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), string, false); + StringT buffer = StrToTCHARs (parent.getCodePage (), string, false); int flags = OS.DT_NOPREFIX | OS.DT_SINGLELINE | OS.DT_CALCRECT; auto hNewDC = hDC; HFONT hFont; diff -r 46c5f8f56b41 -r 2e09b0e6857a org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Widget.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Widget.d Wed Mar 25 08:46:48 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Widget.d Wed Mar 25 11:18:25 2009 +0100 @@ -504,7 +504,7 @@ } char [] fixMnemonic (String string, bool spaces) { - char [] buffer = string ~ '\0'; + char[] buffer = (string ~ '\0').dup; int i = 0, j = 0; while (i < buffer.length) { if (buffer [i] is '&') { @@ -580,7 +580,7 @@ if ((state & KEYED_DATA) !is 0) { Object [] table = (cast(ArrayWrapperObject) data).array; for (int i=1; i