# HG changeset patch # User Frank Benoit # Date 1224360080 -7200 # Node ID 92aa2d7391f38efcf078cbfa8ccd805bfbbb3481 # Parent 68adc3a367d9dbaac4429e2f268c470b62b7fc25 Added 'all.d' package import, a dwt.all for everything and a dwt.std for the essential stuff diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/accessibility/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/accessibility/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,17 @@ +module dwt.accessibility.all; + +public import dwt.accessibility.ACC; +public import dwt.accessibility.Accessible; +public import dwt.accessibility.AccessibleAdapter; +public import dwt.accessibility.AccessibleControlAdapter; +public import dwt.accessibility.AccessibleControlEvent; +public import dwt.accessibility.AccessibleControlListener; +public import dwt.accessibility.AccessibleEvent; +public import dwt.accessibility.AccessibleFactory; +public import dwt.accessibility.AccessibleListener; +public import dwt.accessibility.AccessibleObject; +public import dwt.accessibility.AccessibleTextAdapter; +public import dwt.accessibility.AccessibleTextEvent; +public import dwt.accessibility.AccessibleTextListener; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,20 @@ +module dwt.all; + +public import dwt.DWT; +public import dwt.DWTError; +public import dwt.DWTException; + +public import dwt.accessibility.all; +//public import dwt.browser.all; // not yet usable +public import dwt.custom.all; +public import dwt.dnd.all; +public import dwt.dwthelper.all; +public import dwt.event.all; +public import dwt.graphics.all; +public import dwt.layout.all; +//public import dwt.opengl.all; // dependent on existing bindings +public import dwt.printing.all; +public import dwt.program.all; +public import dwt.widgets.all; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/browser/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/browser/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,40 @@ +module dwt.browser.all; + +public import dwt.browser.AppFileLocProvider; +public import dwt.browser.Browser; +public import dwt.browser.CloseWindowListener; +public import dwt.browser.Download; +public import dwt.browser.DownloadFactory; +public import dwt.browser.DownloadFactory_1_8; +public import dwt.browser.Download_1_8; +public import dwt.browser.FilePicker; +public import dwt.browser.FilePickerFactory; +public import dwt.browser.FilePickerFactory_1_8; +public import dwt.browser.FilePicker_1_8; +public import dwt.browser.HelperAppLauncherDialog; +public import dwt.browser.HelperAppLauncherDialogFactory; +public import dwt.browser.InputStream; +public import dwt.browser.LocationAdapter; +public import dwt.browser.LocationEvent; +public import dwt.browser.LocationListener; +public import dwt.browser.Mozilla; +public import dwt.browser.MozillaDelegate; +public import dwt.browser.OpenWindowListener; +public import dwt.browser.ProgressAdapter; +public import dwt.browser.ProgressEvent; +public import dwt.browser.ProgressListener; +public import dwt.browser.PromptDialog; +public import dwt.browser.PromptService2; +public import dwt.browser.PromptService2Factory; +public import dwt.browser.SimpleEnumerator; +public import dwt.browser.StatusTextEvent; +public import dwt.browser.StatusTextListener; +public import dwt.browser.TitleEvent; +public import dwt.browser.TitleListener; +public import dwt.browser.VisibilityWindowAdapter; +public import dwt.browser.VisibilityWindowListener; +public import dwt.browser.WebBrowser; +public import dwt.browser.WindowCreator2; +public import dwt.browser.WindowEvent; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/custom/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/custom/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,62 @@ +module dwt.custom.all; + +public import dwt.custom.AnimatedProgress; +public import dwt.custom.BidiSegmentEvent; +public import dwt.custom.BidiSegmentListener; +public import dwt.custom.Bullet; +public import dwt.custom.BusyIndicator; +public import dwt.custom.CBanner; +public import dwt.custom.CBannerLayout; +public import dwt.custom.CCombo; +public import dwt.custom.CLabel; +public import dwt.custom.CLayoutData; +public import dwt.custom.CTabFolder2Adapter; +public import dwt.custom.CTabFolder2Listener; +public import dwt.custom.CTabFolder; +public import dwt.custom.CTabFolderAdapter; +public import dwt.custom.CTabFolderEvent; +public import dwt.custom.CTabFolderLayout; +public import dwt.custom.CTabFolderListener; +public import dwt.custom.CTabItem; +public import dwt.custom.ControlEditor; +public import dwt.custom.DefaultContent; +public import dwt.custom.ExtendedModifyEvent; +public import dwt.custom.ExtendedModifyListener; +public import dwt.custom.LineBackgroundEvent; +public import dwt.custom.LineBackgroundListener; +public import dwt.custom.LineStyleEvent; +public import dwt.custom.LineStyleListener; +public import dwt.custom.MovementEvent; +public import dwt.custom.MovementListener; +public import dwt.custom.PaintObjectEvent; +public import dwt.custom.PaintObjectListener; +public import dwt.custom.PopupList; +public import dwt.custom.ST; +public import dwt.custom.SashForm; +public import dwt.custom.SashFormData; +public import dwt.custom.SashFormLayout; +public import dwt.custom.ScrolledComposite; +public import dwt.custom.ScrolledCompositeLayout; +public import dwt.custom.StackLayout; +public import dwt.custom.StyleRange; +public import dwt.custom.StyledText; +public import dwt.custom.StyledTextContent; +public import dwt.custom.StyledTextDropTargetEffect; +public import dwt.custom.StyledTextEvent; +public import dwt.custom.StyledTextListener; +public import dwt.custom.StyledTextPrintOptions; +public import dwt.custom.StyledTextRenderer; +public import dwt.custom.TableCursor; +public import dwt.custom.TableEditor; +public import dwt.custom.TableTree; +public import dwt.custom.TableTreeEditor; +public import dwt.custom.TableTreeItem; +public import dwt.custom.TextChangeListener; +public import dwt.custom.TextChangedEvent; +public import dwt.custom.TextChangingEvent; +public import dwt.custom.TreeEditor; +public import dwt.custom.VerifyKeyListener; +public import dwt.custom.ViewForm; +public import dwt.custom.ViewFormLayout; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/dnd/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/dnd/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,31 @@ +module dwt.dnd.all; + +public import dwt.dnd.ByteArrayTransfer; +public import dwt.dnd.Clipboard; +public import dwt.dnd.ClipboardProxy; +public import dwt.dnd.DND; +public import dwt.dnd.DNDEvent; +public import dwt.dnd.DNDListener; +public import dwt.dnd.DragSource; +public import dwt.dnd.DragSourceAdapter; +public import dwt.dnd.DragSourceEffect; +public import dwt.dnd.DragSourceEvent; +public import dwt.dnd.DragSourceListener; +public import dwt.dnd.DropTarget; +public import dwt.dnd.DropTargetAdapter; +public import dwt.dnd.DropTargetEffect; +public import dwt.dnd.DropTargetEvent; +public import dwt.dnd.DropTargetListener; +public import dwt.dnd.FileTransfer; +public import dwt.dnd.HTMLTransfer; +public import dwt.dnd.ImageTransfer; +public import dwt.dnd.RTFTransfer; +public import dwt.dnd.TableDragSourceEffect; +public import dwt.dnd.TableDropTargetEffect; +public import dwt.dnd.TextTransfer; +public import dwt.dnd.Transfer; +public import dwt.dnd.TransferData; +public import dwt.dnd.TreeDragSourceEffect; +public import dwt.dnd.TreeDropTargetEffect; +public import dwt.dnd.URLTransfer; + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/dwthelper/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/dwthelper/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,20 @@ +module dwt.dwthelper.all; + +public import dwt.dwthelper.BufferedInputStream; +public import dwt.dwthelper.ByteArrayInputStream; +public import dwt.dwthelper.ByteArrayOutputStream; +public import dwt.dwthelper.File; +public import dwt.dwthelper.FileInputStream; +public import dwt.dwthelper.FileOutputStream; +public import dwt.dwthelper.InflaterInputStream; +public import dwt.dwthelper.InputStream; +public import dwt.dwthelper.OutputStream; +public import dwt.dwthelper.ResourceBundle; +public import dwt.dwthelper.Runnable; +public import dwt.dwthelper.System; +public import dwt.dwthelper.WeakHashMap; +public import dwt.dwthelper.WeakRef; +public import dwt.dwthelper.XmlTranscode; +public import dwt.dwthelper.utils; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/dwthelper/utils.d.orig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/dwthelper/utils.d.orig Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,1060 @@ +/** + * Authors: Frank Benoit + */ +module dwt.dwthelper.utils; + +public import dwt.dwthelper.System; +public import Math = tango.math.Math; + +public import tango.core.Exception : IllegalArgumentException, IOException; + +import tango.io.Stdout; +import tango.io.Print; +static import tango.stdc.stringz; +static import tango.text.Util; +static import tango.text.Text; +import tango.text.Unicode; +import tango.text.convert.Utf; +import tango.core.Exception; +import tango.stdc.stdlib : exit; + +import tango.util.log.Trace; +import tango.text.UnicodeData; +static import tango.util.collection.model.Seq; + +alias char[] String; +alias tango.text.Text.Text!(char) StringBuffer; + +void implMissing( String file, uint line ){ + Stderr.formatln( "implementation missing in file {} line {}", file, line ); + Stderr.formatln( "exiting ..." ); + exit(1); +} + +abstract class ArrayWrapper{ +} +abstract class ValueWrapper{ +} + +class ArrayWrapperT(T) : ArrayWrapper { + public T[] array; + public this( T[] data ){ + array = data; + } + public override int opEquals( Object o ){ + if( auto other = cast(ArrayWrapperT!(T))o){ + return array == other.array; + } + return false; + } + public override hash_t toHash(){ + return (typeid(T[])).getHash(&array); + } +} + +class ValueWrapperT(T) : ValueWrapper { + public T value; + public this( T data ){ + value = data; + } + static if( is(T==class) || is(T==interface)){ + public int opEquals( Object other ){ + if( auto o = cast(ValueWrapperT!(T))other ){ + return value == o.value; + } + if( auto o = cast(T)other ){ + if( value is o ){ + return true; + } + if( value is null || o is null ){ + return false; + } + return value == o; + } + return false; + } + } + else{ + public int opEquals( Object other ){ + if( auto o = cast(ValueWrapperT!(T))other ){ + return value == o.value; + } + return false; + } + public int opEquals( T other ){ + return value == other; + } + } + public override hash_t toHash(){ + return (typeid(T)).getHash(&value); + } +} + +class Boolean : ValueWrapperT!(bool) { + public static Boolean TRUE; + public static Boolean FALSE; + + static this(){ + TRUE = new Boolean(true); + FALSE = new Boolean(false); + } + public this( bool v ){ + super(v); + } + + alias ValueWrapperT!(bool).opEquals opEquals; + public int opEquals( int other ){ + return value == ( other !is 0 ); + } + public int opEquals( Object other ){ + if( auto o = cast(Boolean)other ){ + return value == o.value; + } + return false; + } + public bool booleanValue(){ + return value; + } + public static Boolean valueOf( String s ){ + if( s == "yes" || s == "true" ){ + return TRUE; + } + return FALSE; + } + public static Boolean valueOf( bool b ){ + return b ? TRUE : FALSE; + } +} + +alias Boolean ValueWrapperBool; + + +class Byte : ValueWrapperT!(byte) { + public static byte parseByte( String s ){ + try{ + int res = tango.text.convert.Integer.parse( s ); + if( res < byte.min || res > byte.max ){ + throw new NumberFormatException( "out of range" ); + } + return res; + } + catch( IllegalArgumentException e ){ + throw new NumberFormatException( e ); + } + } + this( byte value ){ + super( value ); + } +} +alias Byte ValueWrapperByte; + + +class Integer : ValueWrapperT!(int) { + + public static const int MIN_VALUE = 0x80000000; + public static const int MAX_VALUE = 0x7fffffff; + public static const int SIZE = 32; + + public this ( int value ){ + super( value ); + } + + public this ( String s ){ + super(parseInt(s)); + } + + public static String toString( int i, int radix ){ + switch( radix ){ + case 2: + return toBinaryString(i); + case 8: + return toOctalString(i); + case 10: + return toString(i); + case 16: + return toHexString(i); + default: + implMissing( __FILE__, __LINE__ ); + return null; + } + } + + public static String toHexString( int i ){ + return tango.text.convert.Integer.toString(i, "x" ); + } + + public static String toOctalString( int i ){ + return tango.text.convert.Integer.toString(i, "o" ); + } + + public static String toBinaryString( int i ){ + return tango.text.convert.Integer.toString(i, "b" ); + } + + public static String toString( int i ){ + return tango.text.convert.Integer.toString(i); + } + + public static int parseInt( String s, int radix ){ + try{ + return tango.text.convert.Integer.toLong( s, radix ); + } + catch( IllegalArgumentException e ){ + throw new NumberFormatException( e ); + } + } + + public static int parseInt( String s ){ + try{ + return tango.text.convert.Integer.toLong( s ); + } + catch( IllegalArgumentException e ){ + throw new NumberFormatException( e ); + } + } + + public static Integer valueOf( String s, int radix ){ + implMissing( __FILE__, __LINE__ ); + return null; + } + + public static Integer valueOf( String s ){ + return valueOf( parseInt(s)); + } + + public static Integer valueOf( int i ){ + return new Integer(i); + } + + public byte byteValue(){ + return cast(byte)value; + } + + public short shortValue(){ + return cast(short)value; + } + + public int intValue(){ + return value; + } + + public long longValue(){ + return cast(long)value; + } + + public float floatValue(){ + return cast(float)value; + } + + public double doubleValue(){ + return cast(double)value; + } + + public override hash_t toHash(){ + return intValue(); + } + + public override String toString(){ + return tango.text.convert.Integer.toString( value ); + } +} +alias Integer ValueWrapperInt; + +class Double : ValueWrapperT!(double) { + public static double MAX_VALUE = double.max; + public static double MIN_VALUE = double.min; + this( double value ){ + super(value); + } + this( String str ){ + implMissing( __FILE__, __LINE__ ); + super(0.0); + } + public double doubleValue(){ + return value; + } + public static String toString( double value ){ + implMissing( __FILE__, __LINE__ ); + return null; + } +} + +class Float : ValueWrapperT!(float) { + + public static float POSITIVE_INFINITY = (1.0f / 0.0f); + public static float NEGATIVE_INFINITY = ((-1.0f) / 0.0f); + public static float NaN = (0.0f / 0.0f); + public static float MAX_VALUE = 3.4028235e+38f; + public static float MIN_VALUE = 1.4e-45f; + public static int SIZE = 32; + + this( float value ){ + super(value); + } + this( String str ){ + implMissing( __FILE__, __LINE__ ); + super(0.0); + } + public float floatValue(){ + return value; + } + public static String toString( float value ){ + implMissing( __FILE__, __LINE__ ); + return null; + } + public static float parseFloat( String s ){ + try{ + return tango.text.convert.Float.toFloat( s ); + } + catch( IllegalArgumentException e ){ + throw new NumberFormatException( e ); + } + } + +} +class Long : ValueWrapperT!(long) { + public static const long MIN_VALUE = long.min; + public static const long MAX_VALUE = long.max; + this( long value ){ + super(value); + } + this( String str ){ + implMissing( __FILE__, __LINE__ ); + super(0); + } + public long longValue(){ + return value; + } + public static long parseLong(String s){ + implMissing( __FILE__, __LINE__ ); + return 0; + } + public static String toString( double value ){ + implMissing( __FILE__, __LINE__ ); + return null; + } +} +alias Long ValueWrapperLong; + + +// alias ValueWrapperT!(int) ValueWrapperInt; + +alias ArrayWrapperT!(byte) ArrayWrapperByte; +alias ArrayWrapperT!(int) ArrayWrapperInt; +alias ArrayWrapperT!(Object) ArrayWrapperObject; +alias ArrayWrapperT!(char) ArrayWrapperString; +alias ArrayWrapperT!(String) ArrayWrapperString2; + +Object[] StringArrayToObjectArray( String[] strs ){ + Object[] res = new Object[strs.length]; + foreach( idx, str; strs ){ + res[idx] = new ArrayWrapperString(str); + } + return res; +} +int codepointIndexToIndex( String str, int cpIndex ){ + int cps = cpIndex; + int res = 0; + while( cps > 0 ){ + cps--; + if( str[res] < 0x80 ){ + res+=1; + } + else if( str[res] < 0xE0 ){ + res+=2; + } + else if( str[res] & 0xF0 ){ + res+=3; + } + else{ + res+=4; + } + } + return res; +} + +/++ + + + +/ +int indexToCodepointIndex( String str, int index ){ + if( index < 0 ) return index; + int i = 0; + int res = 0; + while( i < index ){ + if( i >= str.length ){ + break; + } + if( str[i] < 0x80 ){ + i+=1; + } + else if( str[i] < 0xE0 ){ + i+=2; + } + else if( str[i] & 0xF0 ){ + i+=3; + } + else{ + i+=4; + } + res++; + } + return res; +} + +/++ + + Get that String, that contains the next codepoint of a String. + +/ +String firstCodePointStr( String str, out int consumed ){ + dchar[1] buf; + uint ate; + dchar[] res = str.toString32( buf, &ate ); + consumed = ate; + return str[ 0 .. ate ]; +} + +/++ + + Get first codepoint of a String. If an offset is needed, simply use a slice: + + --- + + dchar res = str[ offset .. $ ].firstCodePoint(); + + --- + +/ +dchar firstCodePoint( String str ){ + int dummy; + return firstCodePoint( str, dummy ); +} +dchar firstCodePoint( String str, out int consumed ){ + dchar[1] buf; + uint ate; + dchar[] res = str.toString32( buf, &ate ); + consumed = ate; + if( ate is 0 || res.length is 0 ){ + Trace.formatln( "dwthelper.utils {}: str.length={} str={:X2}", __LINE__, str.length, cast(ubyte[])str ); + } + assert( ate > 0 ); + assert( res.length is 1 ); + return res[0]; +} + +String dcharToString( dchar key ){ + dchar[1] buf; + buf[0] = key; + return tango.text.convert.Utf.toString( buf ); +} + +int codepointCount( String str ){ + scope dchar[] buf = new dchar[]( str.length ); + uint ate; + dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate ); + assert( ate is str.length ); + return res.length; +} + +alias tango.text.convert.Utf.toString16 toString16; +alias tango.text.convert.Utf.toString toString; + +int length( String str ){ + return str.length; +} + +int getRelativeCodePointOffset( String str, int startIndex, int searchRelCp ){ + int ignore; + int i = startIndex; + if( searchRelCp > 0 ){ + while( searchRelCp !is 0 ){ + + if( ( i < str.length ) + && ( str[i] & 0x80 ) is 0x00 ) + { + i+=1; + } + else if( ( i+1 < str.length ) + && (( str[i+1] & 0xC0 ) is 0x80 ) + && (( str[i ] & 0xE0 ) is 0xC0 )) + { + i+=2; + } + else if( ( i+2 < str.length ) + && (( str[i+2] & 0xC0 ) is 0x80 ) + && (( str[i+1] & 0xC0 ) is 0x80 ) + && (( str[i ] & 0xF0 ) is 0xE0 )) + { + i+=3; + } + else if(( i+3 < str.length ) + && (( str[i+3] & 0xC0 ) is 0x80 ) + && (( str[i+2] & 0xC0 ) is 0x80 ) + && (( str[i+1] & 0xC0 ) is 0x80 ) + && (( str[i ] & 0xF8 ) is 0xF0 )) + { + i+=4; + } + else{ + Trace.formatln( "invalid utf8 characters: {:X2}", cast(ubyte[]) str ); + tango.text.convert.Utf.onUnicodeError( "invalid utf8 input", i ); + } + searchRelCp--; + } + } + else if( searchRelCp < 0 ){ + while( searchRelCp !is 0 ){ + do{ + i--; + if( i < 0 ){ + return -1; + //Trace.formatln( "dwthelper.utils getRelativeCodePointOffset {}: str={}, startIndex={}, searchRelCp={}", __LINE__, str, startIndex, searchRelCp ); + //tango.text.convert.Utf.onUnicodeError( "invalid utf8 input", i ); + } + } while(( str[i] & 0xC0 ) is 0x80 ); + searchRelCp++; + } + } + return i - startIndex; +} +dchar getRelativeCodePoint( String str, int startIndex, int searchRelCp, out int relIndex ){ + relIndex = getRelativeCodePointOffset( str, startIndex, searchRelCp ); + int ignore; + return firstCodePoint( str[ startIndex+relIndex .. $ ], ignore ); +} + +int utf8AdjustOffset( String str, int offset ){ + if( str.length <= offset || offset <= 0 ){ + return offset; + } + while(( str[offset] & 0xC0 ) is 0x80 ){ + offset--; + } + return offset; +} +int utf8OffsetIncr( String str, int offset ){ + int res = offset +1; + if( str.length <= res || res <= 0 ){ + return res; + } + int tries = 4; + while(( str[res] & 0xC0 ) is 0x80 ){ + res++; + assert( tries-- > 0 ); + } + return res; +} +int utf8OffsetDecr( String str, int offset ){ + int res = offset-1; + if( str.length <= res || res <= 0 ){ + return res; + } + int tries = 4; + while(( str[res] & 0xC0 ) is 0x80 ){ + res--; + assert( tries-- > 0 ); + } + Trace.formatln( "utf8OffsetDecr {}->{}", offset, res ); + Trace.memory( str ); + return res; +} + +bool CharacterIsDefined( dchar ch ){ + return (ch in tango.text.UnicodeData.unicodeData) !is null; +} +dchar CharacterFirstToLower( String str ){ + int consumed; + return CharacterFirstToLower( str, consumed ); +} +dchar CharacterFirstToLower( String str, out int consumed ){ + dchar[1] buf; + buf[0] = firstCodePoint( str, consumed ); + dchar[] r = tango.text.Unicode.toLower( buf ); + return r[0]; +} + +dchar CharacterToLower( dchar c ){ + dchar[] r = tango.text.Unicode.toLower( [c] ); + return r[0]; +} +dchar CharacterToUpper( dchar c ){ + dchar[] r = tango.text.Unicode.toUpper( [c] ); + return r[0]; +} +bool CharacterIsWhitespace( dchar c ){ + return tango.text.Unicode.isWhitespace( c ); +} +bool CharacterIsDigit( dchar c ){ + return tango.text.Unicode.isDigit( c ); +} +bool CharacterIsLetter( dchar c ){ + return tango.text.Unicode.isLetter( c ); +} +public String toUpperCase( String str ){ + return tango.text.Unicode.toUpper( str ); +} + +public int indexOf( String str, char searched ){ + int res = tango.text.Util.locate( str, searched ); + if( res is str.length ) res = -1; + return res; +} + +public int indexOf( String str, char searched, int startpos ){ + int res = tango.text.Util.locate( str, searched, startpos ); + if( res is str.length ) res = -1; + return res; +} + +public int indexOf(String str, String ch){ + return indexOf( str, ch, 0 ); +} + +public int indexOf(String str, String ch, int start){ + int res = tango.text.Util.locatePattern( str, ch, start ); + if( res is str.length ) res = -1; + return res; +} + +public int lastIndexOf(String str, char ch){ + return lastIndexOf( str, ch, str.length ); +} +public int lastIndexOf(String str, char ch, int formIndex){ + int res = tango.text.Util.locatePrior( str, ch, formIndex ); + if( res is str.length ) res = -1; + return res; +} +public int lastIndexOf(String str, String ch ){ + return lastIndexOf( str, ch, str.length ); +} +public int lastIndexOf(String str, String ch, int start ){ + int res = tango.text.Util.locatePatternPrior( str, ch, start ); + if( res is str.length ) res = -1; + return res; +} + +public String replace( String str, char from, char to ){ + return tango.text.Util.replace( str.dup, from, to ); +} + +public String substring( String str, int start ){ + return str[ start .. $ ].dup; +} + +public String substring( String str, int start, int end ){ + return str[ start .. end ].dup; +} + +public wchar[] substring( wchar[] str, int start ){ + return str[ start .. $ ].dup; +} + +public wchar[] substring( wchar[] str, int start, int end ){ + return str[ start .. end ].dup; +} + +public char charAt( String str, int pos ){ + return str[ pos ]; +} + +public void getChars( String src, int srcBegin, int srcEnd, String dst, int dstBegin){ + dst[ dstBegin .. dstBegin + srcEnd - srcBegin ] = src[ srcBegin .. srcEnd ]; +} + +public wchar[] toCharArray( String str ){ + return toString16( str ); +} + +public bool endsWith( String src, String pattern ){ + if( src.length < pattern.length ){ + return false; + } + return src[ $-pattern.length .. $ ] == pattern; +} + +public bool equals( String src, String other ){ + return src == other; +} + +public bool equalsIgnoreCase( String src, String other ){ + return tango.text.Unicode.toFold(src) == tango.text.Unicode.toFold(other); +} + +public int compareToIgnoreCase( String src, String other ){ + return compareTo( tango.text.Unicode.toFold(src), tango.text.Unicode.toFold(other)); +} +public int compareTo( String src, String other ){ + return typeid(String).compare( cast(void*)&src, cast(void*)&other ); +} + +public bool startsWith( String src, String pattern ){ + if( src.length < pattern.length ){ + return false; + } + return src[ 0 .. pattern.length ] == pattern; +} + +public String toLowerCase( String src ){ + return tango.text.Unicode.toLower( src ); +} + +public hash_t toHash( String src ){ + return typeid(String).getHash(&src); +} + +public String trim( String str ){ + return tango.text.Util.trim( str ).dup; +} +public String intern( String str ){ + return str; +} + +public char* toStringzValidPtr( String src ){ + if( src ){ + return src.toStringz(); + } + else{ + static const String nullPtr = "\0"; + return nullPtr.ptr; + } +} + +public alias tango.stdc.stringz.toStringz toStringz; +public alias tango.stdc.stringz.toString16z toString16z; +public alias tango.stdc.stringz.fromStringz fromStringz; +public alias tango.stdc.stringz.fromString16z fromString16z; + +static String toHex(uint value, bool prefix = true, int radix = 8){ + return tango.text.convert.Integer.toString( + value, + radix is 10 ? "d" : + radix is 8 ? "o" : + radix is 16 ? "x" : + "d" ); +} + +class RuntimeException : Exception { + this( String e = null){ + super(e); + } + this( Exception e ){ + super(e.toString); + next = e; + } + public Exception getCause() { + return next; + } + +} +class IndexOutOfBoundsException : Exception { + this( String e = null){ + super(e); + } +} + +class UnsupportedOperationException : RuntimeException { + this( String e = null){ + super(e); + } + this( Exception e ){ + super(e.toString); + } +} +class NumberFormatException : IllegalArgumentException { + this( String e ){ + super(e); + } + this( Exception e ){ + super(e.toString); + } +} +class NullPointerException : Exception { + this( String e = null ){ + super(e); + } + this( Exception e ){ + super(e.toString); + } +} +class IllegalStateException : Exception { + this( String e = null ){ + super(e); + } + this( Exception e ){ + super(e.toString); + } +} +class InterruptedException : Exception { + this( String e = null ){ + super(e); + } + this( Exception e ){ + super(e.toString); + } +} +class InvocationTargetException : Exception { + Exception cause; + this( Exception e = null, String msg = null ){ + super(msg); + cause = e; + } + + alias getCause getTargetException; + Exception getCause(){ + return cause; + } +} +class MissingResourceException : Exception { + String classname; + String key; + this( String msg, String classname, String key ){ + super(msg); + this.classname = classname; + this.key = key; + } +} +class ParseException : Exception { + this( String e = null ){ + super(e); + } +} + +interface Cloneable{ +} + +interface Comparable { + int compareTo(Object o); +} +interface Comparator { + int compare(Object o1, Object o2); +} +interface EventListener{ +} + +class EventObject { + protected Object source; + + public this(Object source) { + if (source is null) + throw new IllegalArgumentException( "null arg" ); + this.source = source; + } + + public Object getSource() { + return source; + } + + public override String toString() { + return this.classinfo.name ~ "[source=" ~ source.toString() ~ "]"; + } +} + +private struct GCStats { + size_t poolsize; // total size of pool + size_t usedsize; // bytes allocated + size_t freeblocks; // number of blocks marked FREE + size_t freelistsize; // total of memory on free lists + size_t pageblocks; // number of blocks marked PAGE +} +private extern(C) GCStats gc_stats(); + +size_t RuntimeTotalMemory(){ + GCStats s = gc_stats(); + return s.poolsize; +} + +String ExceptionGetLocalizedMessage( Exception e ){ + return e.msg; +} + +void ExceptionPrintStackTrace( Exception e ){ + ExceptionPrintStackTrace( e, Stderr ); +} +void ExceptionPrintStackTrace( Exception e, Print!(char) print ){ + Exception exception = e; + while( exception !is null ){ + print.formatln( "Exception in {}({}): {}", exception.file, exception.line, exception.msg ); + if( exception.info !is null ){ + foreach( msg; exception.info ){ + print.formatln( "trc {}", msg ); + } + } + exception = exception.next; + } +} + +interface Reader{ +} +interface Writer{ +} + + +class Collator : Comparator { + public static Collator getInstance(){ + implMissing( __FILE__, __LINE__ ); + return null; + } + private this(){ + } + int compare(Object o1, Object o2){ + implMissing( __FILE__, __LINE__ ); + return 0; + } +} + +template arraycast(T) { + T[] arraycast(U) (U[] u) { + static if ( + (is (T == interface ) && is (U == interface )) || + (is (T == class ) && is (U == class ))) { + return(cast(T[])u); + } + else { + int l = u.length; + T[] res; + res.length = l; + for (int i = 0; i < l; i++) { + res[i] = cast(T)u[i]; + } + return(res); + } + } +} + +String stringcast( Object o ){ + if( auto str = cast(ArrayWrapperString) o ){ + return str.array; + } + return null; +} +String[] stringcast( Object[] objs ){ + String[] res = new String[](objs.length); + foreach( idx, obj; objs ){ + res[idx] = stringcast(obj); + } + return res; +} +ArrayWrapperString stringcast( String str ){ + return new ArrayWrapperString( str ); +} +ArrayWrapperString[] stringcast( String[] strs ){ + ArrayWrapperString[] res = new ArrayWrapperString[ strs.length ]; + foreach( idx, str; strs ){ + res[idx] = stringcast(str); + } + return res; +} + +String[] stringArrayFromObject( Object obj ){ + if( auto wrapper = cast(ArrayWrapperString2)obj ){ + return wrapper.array; + } + if( auto wrapper = cast(ArrayWrapperObject)obj ){ + String[] res = new String[ wrapper.array.length ]; + foreach( idx, o; wrapper.array ){ + if( auto swrapper = cast(ArrayWrapperString) o ){ + res[idx] = swrapper.array; + } + } + return res; + } + assert( obj is null ); // if not null, it was the wrong type + return null; +} + +T[] arrayFromObject(T)( Object obj ){ + if( auto wrapper = cast(ArrayWrapperObject)obj ){ + T[] res = new T[ wrapper.array.length ]; + foreach( idx, o; wrapper.array ){ + res[idx] = cast(T)o; + } + return res; + } + assert( obj is null ); // if not null, it was the wrong type + return null; +} + + +bool ArrayEquals(T)( T[] a, T[] b ){ + if( a.length !is b.length ){ + return false; + } + for( int i = 0; i < a.length; i++ ){ + static if( is( T==class) || is(T==interface)){ + if( a[i] !is null && b[i] !is null ){ + if( a[i] != b[i] ){ + return false; + } + } + else if( a[i] is null && b[i] is null ){ + } + else{ + return false; + } + } + else{ + if( a[i] != b[i] ){ + return false; + } + } + } + return true; +} + +int SeqIndexOf(T)( tango.util.collection.model.Seq.Seq!(T) s, T src ){ + int idx; + foreach( e; s ){ + if( e == src ){ + return idx; + } + idx++; + } + return -1; +} +int arrayIndexOf(T)( T[] arr, T v ){ + int res = -1; + int idx = 0; + foreach( p; arr ){ + if( p == v){ + res = idx; + break; + } + idx++; + } + return res; +} + +int seqIndexOf( tango.util.collection.model.Seq.Seq!(Object) seq, Object v ){ + int res = -1; + int idx = 0; + foreach( p; seq ){ + if( p == v){ + res = idx; + break; + } + idx++; + } + return res; +} + +void PrintStackTrace( int deepth = 100, String prefix = "trc" ){ + auto e = new Exception( null ); + int idx = 0; + const start = 3; + foreach( msg; e.info ){ + if( idx >= start && idx < start+deepth ) { + Trace.formatln( "{}: {}", prefix, msg ); + } + idx++; + } +} + +struct ImportData{ + void[] data; + String name; + + public static ImportData opCall( void[] data, String name ){ + ImportData res; + res.data = data; + res.name = name; + return res; + } +} + +template getImportData(String name ){ + const ImportData getImportData = ImportData( import(name), name ); +} + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/events/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/events/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,54 @@ +module dwt.events.all; + +public import dwt.events.FocusEvent; +public import dwt.events.MenuListener; +public import dwt.events.ShellAdapter; +public import dwt.events.ModifyListener; +public import dwt.events.MouseListener; +public import dwt.events.MenuEvent; +public import dwt.events.TraverseEvent; +public import dwt.events.VerifyEvent; +public import dwt.events.KeyEvent; +public import dwt.events.FocusListener; +public import dwt.events.PaintEvent; +public import dwt.events.ModifyEvent; +public import dwt.events.MouseWheelListener; +public import dwt.events.DragDetectListener; +public import dwt.events.MouseTrackAdapter; +public import dwt.events.MouseEvent; +public import dwt.events.ControlListener; +public import dwt.events.TraverseListener; +public import dwt.events.ExpandAdapter; +public import dwt.events.SelectionEvent; +public import dwt.events.DragDetectEvent; +public import dwt.events.KeyAdapter; +public import dwt.events.MenuDetectEvent; +public import dwt.events.TypedEvent; +public import dwt.events.ArmListener; +public import dwt.events.ArmEvent; +public import dwt.events.ShellListener; +public import dwt.events.ControlEvent; +public import dwt.events.MouseAdapter; +public import dwt.events.VerifyListener; +public import dwt.events.MouseTrackListener; +public import dwt.events.KeyListener; +public import dwt.events.ExpandEvent; +public import dwt.events.ControlAdapter; +public import dwt.events.MenuAdapter; +public import dwt.events.FocusAdapter; +public import dwt.events.ShellEvent; +public import dwt.events.MouseMoveListener; +public import dwt.events.SelectionAdapter; +public import dwt.events.HelpListener; +public import dwt.events.TreeAdapter; +public import dwt.events.SelectionListener; +public import dwt.events.TreeEvent; +public import dwt.events.MenuDetectListener; +public import dwt.events.DisposeListener; +public import dwt.events.HelpEvent; +public import dwt.events.PaintListener; +public import dwt.events.DisposeEvent; +public import dwt.events.TreeListener; +public import dwt.events.ExpandListener; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/graphics/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/graphics/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,34 @@ +module dwt.graphics.all; + +public import dwt.graphics.Color; +public import dwt.graphics.Cursor; +public import dwt.graphics.Device; +public import dwt.graphics.DeviceData; +public import dwt.graphics.Drawable; +public import dwt.graphics.Font; +public import dwt.graphics.FontData; +public import dwt.graphics.FontMetrics; +public import dwt.graphics.GC; +public import dwt.graphics.GCData; +public import dwt.graphics.GlyphMetrics; +public import dwt.graphics.Image; +public import dwt.graphics.ImageData; +public import dwt.graphics.ImageDataLoader; +public import dwt.graphics.ImageLoader; +public import dwt.graphics.ImageLoaderEvent; +public import dwt.graphics.ImageLoaderListener; +public import dwt.graphics.LineAttributes; +public import dwt.graphics.PaletteData; +public import dwt.graphics.Path; +public import dwt.graphics.PathData; +public import dwt.graphics.Pattern; +public import dwt.graphics.Point; +public import dwt.graphics.RGB; +public import dwt.graphics.Rectangle; +public import dwt.graphics.Region; +public import dwt.graphics.Resource; +public import dwt.graphics.TextLayout; +public import dwt.graphics.TextStyle; +public import dwt.graphics.Transform; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/layout/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/layout/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,13 @@ +module dwt.layout.all; + +public import dwt.layout.FillData; +public import dwt.layout.FillLayout; +public import dwt.layout.FormAttachment; +public import dwt.layout.FormData; +public import dwt.layout.FormLayout; +public import dwt.layout.GridData; +public import dwt.layout.GridLayout; +public import dwt.layout.RowData; +public import dwt.layout.RowLayout; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/opengl/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/opengl/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,6 @@ +module dwt.opengl.all; + +public import dwt.opengl.GLCanvas; +public import dwt.opengl.GLData; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/printing/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/printing/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,7 @@ +module dwt.printing.all; + +public import dwt.printing.PrintDialog; +public import dwt.printing.Printer; +public import dwt.printing.PrinterData; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/program/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/program/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,5 @@ +module dwt.program.all; + +public import dwt.program.Program; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/std.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/std.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,13 @@ +module dwt.std; + +public import dwt.DWT; +public import dwt.DWTError; +public import dwt.DWTException; +public import dwt.dwthelper.utils; + +public import dwt.event.all; +public import dwt.graphics.all; +public import dwt.layout.all; +public import dwt.widgets.all; + + diff -r 68adc3a367d9 -r 92aa2d7391f3 dwt/widgets/all.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/widgets/all.d Sat Oct 18 22:01:20 2008 +0200 @@ -0,0 +1,64 @@ +module dwt.widgets.all; + +public import dwt.widgets.Button; +public import dwt.widgets.Canvas; +public import dwt.widgets.Caret; +public import dwt.widgets.ColorDialog; +public import dwt.widgets.Combo; +public import dwt.widgets.Composite; +public import dwt.widgets.Control; +public import dwt.widgets.CoolBar; +public import dwt.widgets.CoolItem; +public import dwt.widgets.DateTime; +public import dwt.widgets.Decorations; +public import dwt.widgets.Dialog; +public import dwt.widgets.DirectoryDialog; +public import dwt.widgets.Display; +public import dwt.widgets.Event; +public import dwt.widgets.EventTable; +public import dwt.widgets.ExpandBar; +public import dwt.widgets.ExpandItem; +public import dwt.widgets.FileDialog; +public import dwt.widgets.FontDialog; +public import dwt.widgets.Group; +public import dwt.widgets.IME; +public import dwt.widgets.ImageList; +public import dwt.widgets.Item; +public import dwt.widgets.Label; +public import dwt.widgets.Layout; +public import dwt.widgets.Link; +public import dwt.widgets.List; +public import dwt.widgets.Listener; +public import dwt.widgets.Menu; +public import dwt.widgets.MenuItem; +public import dwt.widgets.MessageBox; +public import dwt.widgets.Monitor; +public import dwt.widgets.ProgressBar; +public import dwt.widgets.RunnableLock; +public import dwt.widgets.Sash; +public import dwt.widgets.Scale; +public import dwt.widgets.ScrollBar; +public import dwt.widgets.Scrollable; +public import dwt.widgets.Shell; +public import dwt.widgets.Slider; +public import dwt.widgets.Spinner; +public import dwt.widgets.Synchronizer; +public import dwt.widgets.TabFolder; +public import dwt.widgets.TabItem; +public import dwt.widgets.Table; +public import dwt.widgets.TableColumn; +public import dwt.widgets.TableItem; +public import dwt.widgets.Text; +public import dwt.widgets.ToolBar; +public import dwt.widgets.ToolItem; +public import dwt.widgets.ToolTip; +public import dwt.widgets.Tracker; +public import dwt.widgets.Tray; +public import dwt.widgets.TrayItem; +public import dwt.widgets.Tree; +public import dwt.widgets.TreeColumn; +public import dwt.widgets.TreeItem; +public import dwt.widgets.TypedListener; +public import dwt.widgets.Widget; + +