# HG changeset patch # User Frank Benoit # Date 1237579206 -3600 # Node ID 4bffbf81e2d6e28890bb9480a3c1147f590dce91 # Parent ee1dd551f5b1ace6606a813eae021cf1c33bde06 redirect direct prints to DwtLogger diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/DWTError.d --- a/dwt/DWTError.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/DWTError.d Fri Mar 20 21:00:06 2009 +0100 @@ -17,7 +17,6 @@ import dwt.DWT; import tango.core.Exception; -import tango.io.Stdout; /** * This error is thrown whenever an unrecoverable error @@ -150,14 +149,14 @@ *

*/ public void printStackTrace () { - Stderr.formatln( "stacktrace follows (if feature compiled in)" ); + getDwtLogger().error( "stacktrace follows (if feature compiled in)" ); foreach( msg; info ){ - Stderr.formatln( "{}", msg ); + getDwtLogger().error( "{}", msg ); } if ( throwable !is null) { - Stderr.formatln ("*** Stack trace of contained error ***"); //$NON-NLS-1$ + getDwtLogger().error ("*** Stack trace of contained error ***"); //$NON-NLS-1$ foreach( msg; throwable.info ){ - Stderr.formatln( "{}", msg ); + getDwtLogger().error( "{}", msg ); } } } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/DWTException.d --- a/dwt/DWTException.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/DWTException.d Fri Mar 20 21:00:06 2009 +0100 @@ -17,7 +17,6 @@ import dwt.DWT; import tango.core.Exception; -import tango.io.Stdout; /** * This runtime exception is thrown whenever a recoverable error @@ -141,14 +140,14 @@ *

*/ public void printStackTrace () { - Stderr.formatln( "stacktrace follows (if feature compiled in)" ); + getDwtLogger().error( "stacktrace follows (if feature compiled in)" ); foreach( msg; info ){ - Stderr.formatln( "{}", msg ); + getDwtLogger().error( "{}", msg ); } if ( throwable !is null) { - Stderr.formatln ("*** Stack trace of contained exception ***"); //$NON-NLS-1$ + getDwtLogger().error ("*** Stack trace of contained exception ***"); //$NON-NLS-1$ foreach( msg; throwable.info ){ - Stderr.formatln( "{}", msg ); + getDwtLogger().error( "{}", msg ); } } } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/accessibility/AccessibleFactory.d --- a/dwt/accessibility/AccessibleFactory.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/accessibility/AccessibleFactory.d Fri Mar 20 21:00:06 2009 +0100 @@ -25,8 +25,6 @@ import dwt.DWT; -import tango.io.Stdout; - class AccessibleFactory { AtkObjectFactory * handle; uint objectParentType; @@ -147,7 +145,7 @@ } } else{ - Stdout.formatln( "AccessibleFactory.atkObjectFactoryCB_create_accessible cannot find factory instance" ); + getDwtLogger().info( "AccessibleFactory.atkObjectFactoryCB_create_accessible cannot find factory instance" ); } } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/accessibility/AccessibleObject.d --- a/dwt/accessibility/AccessibleObject.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/accessibility/AccessibleObject.d Fri Mar 20 21:00:06 2009 +0100 @@ -25,7 +25,6 @@ import dwt.accessibility.AccessibleFactory; import dwt.widgets.Display; import dwt.dwthelper.utils; -import tango.io.Stdout; import tango.text.Util; import Math = tango.math.Math; @@ -73,7 +72,7 @@ this.accessible = accessible; this.isLightweight = isLightweight; AccessibleObjects[handle] = this; - if (DEBUG) Stdout.formatln("new AccessibleObject: {}", handle); + if (DEBUG) getDwtLogger().info("new AccessibleObject: {}", handle); } void addChild (AccessibleObject child) { @@ -83,7 +82,7 @@ package static extern(C) char* atkAction_get_keybinding (void* obj, int index) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkAction_get_keybinding"); + if (DEBUG) getDwtLogger().info ("-->atkAction_get_keybinding"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; char* parentResult; @@ -116,7 +115,7 @@ package static extern(C) char* atkAction_get_name (void* obj, int index) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkAction_get_name"); + if (DEBUG) getDwtLogger().info ("-->atkAction_get_name"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; char* parentResult; @@ -149,7 +148,7 @@ package static extern(C) void atkComponent_get_extents (void* obj, int* x, int* y, int* width, int* height, int coord_type) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkComponent_get_extents"); + if (DEBUG) getDwtLogger().info ("-->atkComponent_get_extents"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; *x = 0; @@ -203,7 +202,7 @@ package static extern(C) void atkComponent_get_position (void* obj, int* x, int* y, int coord_type) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkComponent_get_position, object: {} x:{} y:{} coord:{}", atkObject, x, y, coord_type); + if (DEBUG) getDwtLogger().info ("-->atkComponent_get_position, object: {} x:{} y:{} coord:{}", atkObject, x, y, coord_type); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; *x=0; @@ -255,7 +254,7 @@ //package static extern(C) void atkComponent_get_size (void* obj, int* width, int* height, int coord_type) { package static extern(C) void atkComponent_get_size (void* obj, int* width, int* height) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkComponent_get_size"); + if (DEBUG) getDwtLogger().info ("-->atkComponent_get_size"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; *width=0; @@ -286,7 +285,7 @@ package static extern(C) AtkObject* atkComponent_ref_accessible_at_point (void* obj, int x, int y, int coord_type) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkComponent_ref_accessible_at_point"); + if (DEBUG) getDwtLogger().info ("-->atkComponent_ref_accessible_at_point"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; AtkObject* parentResult; @@ -327,24 +326,24 @@ package static extern(C) AtkHyperlink* atkHypertext_get_link (void* obj, int link_index) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkHypertext_get_link"); + if (DEBUG) getDwtLogger().info ("-->atkHypertext_get_link"); return null; } package static extern(C) int atkHypertext_get_n_links (void* obj) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkHypertext_get_n_links"); + if (DEBUG) getDwtLogger().info ("-->atkHypertext_get_n_links"); return 0; /* read hyperlink's name */ } package static extern(C) int atkHypertext_get_link_index (void* obj, int char_index) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkHypertext_get_link_index"); + if (DEBUG) getDwtLogger().info ("-->atkHypertext_get_link_index"); return 0; } package static extern(C) char* atkObject_get_description (AtkObject* atkObject) { - if (DEBUG) Stdout.formatln ("-->atkObject_get_description"); + if (DEBUG) getDwtLogger().info ("-->atkObject_get_description"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; char* parentResult; @@ -372,7 +371,7 @@ return descriptionPtr.ptr; } package static extern(C) char* atkObject_get_name (AtkObject* atkObject) { - if (DEBUG) Stdout.formatln ("-->atkObject_get_name: {}", atkObject); + if (DEBUG) getDwtLogger().info ("-->atkObject_get_name: {}", atkObject); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; char* parentResult; @@ -400,7 +399,7 @@ } package static extern(C) int atkObject_get_n_children (AtkObject* atkObject) { - if (DEBUG) Stdout.formatln ("-->atkObject_get_n_children: {}", atkObject); + if (DEBUG) getDwtLogger().info ("-->atkObject_get_n_children: {}", atkObject); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; int /*long*/ parentResult = 0; @@ -421,7 +420,7 @@ } package static extern(C) int atkObject_get_index_in_parent (AtkObject* atkObject) { - if (DEBUG) Stdout.formatln ("-->atkObjectCB_get_index_in_parent. "); + if (DEBUG) getDwtLogger().info ("-->atkObjectCB_get_index_in_parent. "); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; if (object.index !is -1) return object.index; @@ -431,7 +430,7 @@ } package static extern(C) AtkObject* atkObject_get_parent (AtkObject* atkObject) { - if (DEBUG) Stdout.formatln ("-->atkObject_get_parent: {}", atkObject); + if (DEBUG) getDwtLogger().info ("-->atkObject_get_parent: {}", atkObject); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; if (object.parent !is null) return object.parent.handle; @@ -441,7 +440,7 @@ } package static extern(C) int atkObject_get_role (AtkObject* atkObject) { - if (DEBUG) Stdout.formatln ("-->atkObject_get_role: {}", atkObject); + if (DEBUG) getDwtLogger().info ("-->atkObject_get_role: {}", atkObject); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; if (object.getAccessibleListeners ().length !is 0) { @@ -494,7 +493,7 @@ } package static extern(C) AtkObject* atkObject_ref_child (AtkObject* atkObject, int /*long*/ index) { - if (DEBUG) Stdout.formatln ("-->atkObject_ref_child: {} of: {}", index, atkObject); + if (DEBUG) getDwtLogger().info ("-->atkObject_ref_child: {} of: {}", index, atkObject); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; object.updateChildren (); @@ -509,7 +508,7 @@ } package static extern(C) AtkStateSet * atkObject_ref_state_set (AtkObject* atkObject) { - if (DEBUG) Stdout.formatln ("-->atkObject_ref_state_set"); + if (DEBUG) getDwtLogger().info ("-->atkObject_ref_state_set"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; AtkStateSet* parentResult; @@ -551,7 +550,7 @@ package static extern(C) int atkSelection_is_child_selected (void* obj, int index) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkSelection_is_child_selected"); + if (DEBUG) getDwtLogger().info ("-->atkSelection_is_child_selected"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; int /*long*/ parentResult = 0; @@ -578,7 +577,7 @@ package static extern(C) AtkObject* atkSelection_ref_selection (void* obj, int index) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkSelection_ref_selection"); + if (DEBUG) getDwtLogger().info ("-->atkSelection_ref_selection"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; AtkObject* parentResult; @@ -607,7 +606,7 @@ package static extern(C) int atkText_get_caret_offset (void* obj) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkText_get_caret_offset"); + if (DEBUG) getDwtLogger().info ("-->atkText_get_caret_offset"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; int /*long*/ parentResult = 0; @@ -631,7 +630,7 @@ package static extern(C) uint atkText_get_character_at_offset (void* obj, int offset) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkText_get_character_at_offset"); + if (DEBUG) getDwtLogger().info ("-->atkText_get_character_at_offset"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; String text = object.getText (); @@ -647,7 +646,7 @@ package static extern(C) int atkText_get_character_count (void* obj) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkText_get_character_count"); + if (DEBUG) getDwtLogger().info ("-->atkText_get_character_count"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; String text = object.getText (); @@ -663,7 +662,7 @@ package static extern(C) int atkText_get_n_selections (void* obj) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln("-->atkText_get_n_selections"); + if (DEBUG) getDwtLogger().info("-->atkText_get_n_selections"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return 0; int /*long*/ parentResult = 0; @@ -686,7 +685,7 @@ package static extern(C) char* atkText_get_selection (void* obj, int selection_num, int* start_offset, int* end_offset) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkText_get_selection"); + if (DEBUG) getDwtLogger().info ("-->atkText_get_selection"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; *start_offset=0; @@ -718,7 +717,7 @@ package static extern(C) char* atkText_get_text (void* obj, int start_offset, int end_offset) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkText_get_text: {},{}", start_offset, end_offset); + if (DEBUG) getDwtLogger().info ("-->atkText_get_text: {},{}", start_offset, end_offset); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; String text = object.getText (); @@ -740,7 +739,7 @@ package static extern(C) char* atkText_get_text_after_offset (void* obj, int offset_value, int boundary_type, int* start_offset, int* end_offset) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkText_get_text_after_offset"); + if (DEBUG) getDwtLogger().info ("-->atkText_get_text_after_offset"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; int offset = cast(int)/*64*/offset_value; @@ -917,7 +916,7 @@ package static extern(C) char* atkText_get_text_at_offset (void* obj, int offset_value, int boundary_type, int* start_offset, int* end_offset) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkText_get_text_at_offset: {} start: {} end: {}", offset_value, start_offset, end_offset); + if (DEBUG) getDwtLogger().info ("-->atkText_get_text_at_offset: {} start: {} end: {}", offset_value, start_offset, end_offset); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; int offset = offset_value; @@ -1035,7 +1034,7 @@ package static extern(C) char* atkText_get_text_before_offset (void* obj, int offset_value, int boundary_type, int* start_offset, int* end_offset) { auto atkObject = cast(AtkObject*)obj; - if (DEBUG) Stdout.formatln ("-->atkText_get_text_before_offset"); + if (DEBUG) getDwtLogger().info ("-->atkText_get_text_before_offset"); AccessibleObject object = getAccessibleObject (atkObject); if (object is null) return null; int offset = offset_value; @@ -1280,7 +1279,7 @@ } void release () { - if (DEBUG) Stdout.formatln("AccessibleObject.release: {}", handle); + if (DEBUG) getDwtLogger().info("AccessibleObject.release: {}", handle); accessible = null; foreach( child; children ){ if (child.isLightweight) OS.g_object_unref (child.handle); diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/browser/Browser.d --- a/dwt/browser/Browser.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/browser/Browser.d Fri Mar 20 21:00:06 2009 +0100 @@ -15,7 +15,6 @@ import dwt.dwthelper.utils; import tango.core.Thread; -import tango.io.Stdout; import dwt.DWT; import dwt.DWTError; @@ -372,7 +371,7 @@ name = name.substring(0, name.lastIndexOf('.')); int index = name.lastIndexOf('.'); if (!name.substring (0, index + 1).equals (PACKAGE_PREFIX)) { - Stdout ("name: ")(name.substring(0, index + 1))(" == " )(PACKAGE_PREFIX).newline; + getDwtLogger().info("name: {} == {}", name.substring(0, index + 1), PACKAGE_PREFIX); DWT.error (DWT.ERROR_INVALID_SUBCLASS); } } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/browser/Mozilla.d --- a/dwt/browser/Mozilla.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/browser/Mozilla.d Fri Mar 20 21:00:06 2009 +0100 @@ -15,7 +15,6 @@ import dwt.dwthelper.utils; import tango.text.locale.Core; -import tango.io.Stdout; import tango.text.convert.Format; import tango.io.Console; import tango.sys.Environment; @@ -1442,7 +1441,7 @@ extern(D) static String error (int code, char[] file, int line) { - Stdout ("File: ")(file)(" Line: ")(line).newline; + getDwtLogger().info( "File: {} Line: {}", file, line); throw new DWTError ("XPCOM error " ~ Integer.toString(code)); //$NON-NLS-1$ } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/dwthelper/InflaterInputStream.d --- a/dwt/dwthelper/InflaterInputStream.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/dwthelper/InflaterInputStream.d Fri Mar 20 21:00:06 2009 +0100 @@ -5,7 +5,6 @@ public import dwt.dwthelper.InputStream; import dwt.dwthelper.utils; -import tango.io.Stdout; import tango.io.compress.ZlibStream; version(Windows){ version(build){ diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/dwthelper/ResourceBundle.d --- a/dwt/dwthelper/ResourceBundle.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/dwthelper/ResourceBundle.d Fri Mar 20 21:00:06 2009 +0100 @@ -4,7 +4,6 @@ module dwt.dwthelper.ResourceBundle; import tango.text.Util; -import tango.io.Stdout; import dwt.DWT; import dwt.dwthelper.utils; @@ -52,7 +51,6 @@ String line; int dataIndex; - //tango.io.Stdout.Stdout.formatln( "properties put ..." ); void readLine(){ line.length = 0; char i = data[ dataIndex++ ]; @@ -62,22 +60,18 @@ } } - //tango.io.Stdout.Stdout.formatln( "properties put {}", __LINE__ ); bool linecontinue = false; bool iskeypart = true; String key; String value; nextline: while( dataIndex < data.length ){ - //tango.io.Stdout.Stdout.formatln( "properties put {} startline", __LINE__ ); readLine(); line = dwt.dwthelper.utils.trim(line); if( line.length is 0 ){ - //tango.io.Stdout.Stdout.formatln( "properties put {} was 0 length", __LINE__ ); continue; } if( line[0] == '#' ){ - //tango.io.Stdout.Stdout.formatln( "properties put {} was comment", __LINE__ ); continue; } int pos = 0; @@ -138,10 +132,8 @@ } key = dwt.dwthelper.utils.trim(key); value = dwt.dwthelper.utils.trim(value); - //tango.io.Stdout.Stdout.formatln( "properties put {}=>{}", key, value ); map[ key.dup ] = value.dup; - //tango.io.Stdout.Stdout.formatln( "properties put {}", __LINE__ ); } } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/dwthelper/utils.d --- a/dwt/dwthelper/utils.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/dwthelper/utils.d Fri Mar 20 21:00:06 2009 +0100 @@ -10,13 +10,7 @@ public import tango.core.Exception : IllegalArgumentException, IOException; import tango.io.Stdout; -version(TANGOSVN) { - import tango.io.stream.Format; - alias FormatOutput Print; -} -else - import tango.io.Print; - +import tango.io.stream.Format; static import tango.stdc.stringz; static import tango.text.Util; static import tango.text.Text; @@ -26,17 +20,21 @@ import tango.core.Exception; import tango.stdc.stdlib : exit; -import tango.util.log.Trace; +import tango.util.log.Log; import tango.text.UnicodeData; +Logger getDwtLogger(){ + return Log.lookup( "dwt" ); +} + alias char[] String; alias tango.text.Text.Text!(char) StringBuffer; alias ArrayBoundsException ArrayIndexOutOfBoundsException; void implMissing( String file, uint line ){ - Stderr.formatln( "implementation missing in file {} line {}", file, line ); - Stderr.formatln( "exiting ..." ); + getDwtLogger().fatal( "implementation missing in file {} line {}", file, line ); + getDwtLogger().fatal( "exiting ..." ); exit(1); } @@ -59,6 +57,11 @@ public override hash_t toHash(){ return (typeid(T[])).getHash(&array); } + static if( is( T == char )){ + public override char[] toString(){ + return array; + } + } } class ValueWrapperT(T) : ValueWrapper { @@ -449,7 +452,7 @@ 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 ); + getDwtLogger().trace( "dwthelper.utils {}: str.length={} str={:X2}", __LINE__, str.length, cast(ubyte[])str ); } assert( ate > 0 ); assert( res.length is 1 ); @@ -461,7 +464,7 @@ 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 ); + getDwtLogger().trace( "dwthelper.utils {}: str.length={} str={:X2}", __LINE__, str.length, cast(ubyte[])str ); } assert( ate > 0 ); assert( res.length is 1 ); @@ -485,17 +488,54 @@ alias tango.text.convert.Utf.toString16 toString16; alias tango.text.convert.Utf.toString toString; +int toAbsoluteCodePointStartOffset( String str, int index ){ + //getDwtLogger().trace( "str={}, str.length={}, index={}", str, str.length, index ); + //Trace.memory( str ); + if( str.length is index ){ + return index; + } + if( ( str[index] & 0x80 ) is 0x00 ) { + return index; + } + else{ + int steps = 0; + while(( str[index] & 0xC0 ) is 0x80 ){ + index--; + steps++; + if( steps > 3 || index < 0 ){ + break; + } + } + if((( str[index] & 0xE0 ) is 0xC0) && ( steps <= 1 )){ + // ok + } + else if((( str[index] & 0xF0 ) is 0xE0) && ( steps <= 2 )){ + // ok + } + else if((( str[index] & 0xF8 ) is 0xF0) && ( steps <= 3 )){ + // ok + } + else{ + tango.text.convert.Utf.onUnicodeError( "invalid utf8 input to toAbsoluteCodePointStartOffset" ); + } + return index; + } +} int getRelativeCodePointOffset( String str, int startIndex, int searchRelCp ){ return getAbsoluteCodePointOffset( str, startIndex, searchRelCp ) - startIndex; } int getAbsoluteCodePointOffset( String str, int startIndex, int searchRelCp ){ + + //getDwtLogger().trace( "str={}, str.length={}, startIndex={}, searchRelCp={}", str, str.length, startIndex, searchRelCp ); + //Trace.memory( str ); + int ignore; int i = startIndex; if( searchRelCp > 0 ){ while( searchRelCp !is 0 ){ if( ( i < str.length ) - && ( str[i] & 0x80 ) is 0x00 ) + && (( str[i] & 0x80 ) is 0x00 )) { i+=1; } @@ -521,7 +561,7 @@ i+=4; } else{ - Trace.formatln( "invalid utf8 characters: {:X2}", cast(ubyte[]) str ); + getDwtLogger().trace( "getAbsoluteCodePointOffset invalid utf8 characters: {:X2}", cast(ubyte[]) str ); tango.text.convert.Utf.onUnicodeError( "invalid utf8 input", i ); } searchRelCp--; @@ -533,8 +573,6 @@ i--; if( i < 0 ){ return startIndex-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++; @@ -560,8 +598,8 @@ i+=2; } else{ - Trace.formatln( "invalid utf8 characters: {:X2}", cast(ubyte[]) str ); - tango.text.convert.Utf.onUnicodeError( "invalid utf8 input", i ); + getDwtLogger().trace( "invalid utf16 characters: {:X2}", cast(ubyte[]) str ); + tango.text.convert.Utf.onUnicodeError( "invalid utf16 input", i ); } searchRelCp--; } @@ -572,8 +610,8 @@ i--; if( i < 0 ){ return startIndex-1; - //Trace.formatln( "dwthelper.utils getRelativeCodePointOffset {}: str={}, startIndex={}, searchRelCp={}", __LINE__, str, startIndex, searchRelCp ); - //tango.text.convert.Utf.onUnicodeError( "invalid utf8 input", i ); + //getDwtLogger().trace( "dwthelper.utils getRelativeCodePointOffset {}: str={}, startIndex={}, searchRelCp={}", __LINE__, str, startIndex, searchRelCp ); + //tango.text.convert.Utf.onUnicodeError( "invalid utf16 input", i ); } } while(( str[i] & 0xDC00 ) is 0xDC00 ); searchRelCp++; @@ -622,8 +660,8 @@ res--; assert( tries-- > 0 ); } - Trace.formatln( "utf8OffsetDecr {}->{}", offset, res ); - Trace.memory( str ); + getDwtLogger().trace( "utf8OffsetDecr {}->{}", offset, res ); + //Trace.memory( str ); return res; } @@ -1040,7 +1078,7 @@ void ExceptionPrintStackTrace( Exception e ){ ExceptionPrintStackTrace( e, Stderr ); } -void ExceptionPrintStackTrace( Exception e, Print!(char) print ){ +void ExceptionPrintStackTrace( Exception e, FormatOutput!(char) print ){ Exception exception = e; while( exception !is null ){ print.formatln( "Exception in {}({}): {}", exception.file, exception.line, exception.msg ); @@ -1260,7 +1298,7 @@ const start = 3; foreach( msg; e.info ){ if( idx >= start && idx < start+deepth ) { - Trace.formatln( "{}: {}", prefix, msg ); + getDwtLogger().trace( "{}: {}", prefix, msg ); } idx++; } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/dwthelper/utils.d.orig --- a/dwt/dwthelper/utils.d.orig Fri Mar 20 20:30:32 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1060 +0,0 @@ -/** - * 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 ee1dd551f5b1 -r 4bffbf81e2d6 dwt/graphics/Device.d --- a/dwt/graphics/Device.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/graphics/Device.d Fri Mar 20 21:00:06 2009 +0100 @@ -28,7 +28,6 @@ import dwt.dwthelper.utils; import tango.core.Exception; -import tango.io.Stdout; /** * This class is the abstract superclass of all device objects, @@ -841,7 +840,7 @@ if (device.warningLevel is 0) { if (DEBUG || device.debugging) { foreach( msg; (new Exception ("")).info ){ - Stderr.formatln( "trc {}", msg ); + getDwtLogger().error( "{}", msg ); } } //PORTING_FIXME ?? @@ -860,13 +859,13 @@ if (device !is null) { if (DEBUG || device.debugging) { foreach( msg; (new Exception ("")).info ){ - Stderr.formatln( "trc {}", msg ); + getDwtLogger().error( "trc {}", msg ); } } } else { if (DEBUG) { foreach( msg; (new Exception ("")).info ){ - Stderr.formatln( "trc {}", msg ); + getDwtLogger().error( "{}", msg ); } } } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/graphics/FontData.d --- a/dwt/graphics/FontData.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/graphics/FontData.d Fri Mar 20 21:00:06 2009 +0100 @@ -19,7 +19,6 @@ import tango.text.Util : locate; import tango.util.Convert; import dwt.dwthelper.utils; -import tango.util.log.Trace; /** * Instances of this class describe operating system fonts. @@ -277,7 +276,7 @@ result = result[0 .. $ - 1]; } } -Trace.formatln( "getLocal {}", result ); +getDwtLogger().trace( "getLocal {}", result ); return result; } @@ -364,7 +363,7 @@ * @see java.util.Locale#toString */ public void setLocale(String locale) { -Trace.formatln( "setLocal {}", locale ); +getDwtLogger().trace( "setLocal {}", locale ); lang = country = variant = null; if (locale !is null) { char sep = '_'; diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/internal/c/glx.d --- a/dwt/internal/c/glx.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/internal/c/glx.d Fri Mar 20 21:00:06 2009 +0100 @@ -12,7 +12,6 @@ version(DYNLINK){ import tango.sys.SharedLib : SharedLib; - import tango.util.log.Trace; struct Symbol{ String name; void** symbol; @@ -35,11 +34,11 @@ } catch(Exception e){} if( *s.symbol is null ){ - Trace.formatln( "{}: Symbol '{}' not found", libname, s.name ); + getDwtLogger().trace( "{}: Symbol '{}' not found", libname, s.name ); } } } else { - Trace.formatln( "Could not load the library {}", libname ); + getDwtLogger().trace( "Could not load the library {}", libname ); } } } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/internal/c/gtk.d --- a/dwt/internal/c/gtk.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/internal/c/gtk.d Fri Mar 20 21:00:06 2009 +0100 @@ -27,7 +27,6 @@ import tango.sys.SharedLib : SharedLib; - import tango.util.log.Trace; struct Symbol{ String name; void** symbol; @@ -50,14 +49,14 @@ } catch(Exception e){} if( *s.symbol is null ){ - //Trace.formatln( "{}: Symbol '{}' not found", libname, s.name ); + //getDwtLogger().trace( "{}: Symbol '{}' not found", libname, s.name ); } else{ loaded++; } } } else { - Trace.formatln( "Could not load the library {}", libname ); + getDwtLogger().trace( "Could not load the library {}", libname ); } assert( gtk_check_version !is null ); } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/internal/c/gtk_unix_print_2_0.d --- a/dwt/internal/c/gtk_unix_print_2_0.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/internal/c/gtk_unix_print_2_0.d Fri Mar 20 21:00:06 2009 +0100 @@ -10,7 +10,6 @@ version(DYNLINK){ import tango.sys.SharedLib : SharedLib; - import tango.util.log.Trace; struct Symbol{ String name; void** symbol; @@ -33,11 +32,11 @@ } catch(Exception e){} if( *s.symbol is null ){ - Trace.formatln( "{}: Symbol '{}' not found", libname, s.name ); + getDwtLogger().trace( "{}: Symbol '{}' not found", libname, s.name ); } } } else { - Trace.formatln( "Could not load the library {}", libname ); + getDwtLogger().trace( "Could not load the library {}", libname ); } } } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/internal/c/pango.d --- a/dwt/internal/c/pango.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/internal/c/pango.d Fri Mar 20 21:00:06 2009 +0100 @@ -12,7 +12,6 @@ version(DYNLINK){ import tango.sys.SharedLib : SharedLib; - import tango.util.log.Trace; struct Symbol{ String name; void** symbol; @@ -35,14 +34,14 @@ } catch(Exception e){} if( *s.symbol is null ){ - Trace.formatln( "{}: Symbol '{}' not found", libname, s.name ); + getDwtLogger().trace( "{}: Symbol '{}' not found", libname, s.name ); } else{ loaded++; } } } else { - Trace.formatln( "Could not load the library {}", libname ); + getDwtLogger().trace( "Could not load the library {}", libname ); } } } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/internal/gtk/OS.d --- a/dwt/internal/gtk/OS.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/internal/gtk/OS.d Fri Mar 20 21:00:06 2009 +0100 @@ -21,7 +21,6 @@ import tango.core.Traits; import tango.stdc.locale; import tango.stdc.posix.stdlib : realpath; -import tango.util.log.Trace; import dwt.internal.c.gtk, dwt.internal.c.gdk, diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/printing/Printer.d --- a/dwt/printing/Printer.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/printing/Printer.d Fri Mar 20 21:00:06 2009 +0100 @@ -28,7 +28,6 @@ import dwt.printing.PrinterData; import dwt.dwthelper.utils; -import tango.io.Stdout; import tango.util.Convert; @@ -205,7 +204,7 @@ char [] valueBuffer = new char [end - start]; System.arraycopy (settingsData, start, valueBuffer, 0, valueBuffer.length); OS.gtk_print_settings_set(settings, keyBuffer.ptr, valueBuffer.ptr); - if (DEBUG) Stdout.formatln("{}: {}", keyBuffer, valueBuffer ); + if (DEBUG) getDwtLogger().info("{}: {}", keyBuffer, valueBuffer ); } end++; // skip extra null terminator @@ -338,7 +337,7 @@ char [] valueBuffer = new char [length_]; System.arraycopy (settingsData, start, valueBuffer, 0, length_); - if (DEBUG) tango.io.Stdout.Stdout.formatln( "{}: {}", keyBuffer, valueBuffer ); + if (DEBUG) getDwtLogger().info( "{}: {}", keyBuffer, valueBuffer ); return valueBuffer; } @@ -604,7 +603,7 @@ public override Point getDPI() { checkDevice(); int resolution = OS.gtk_print_settings_get_resolution(settings); - if (DEBUG) tango.io.Stdout.Stdout.formatln("print_settings.resolution={}", resolution); + if (DEBUG) getDwtLogger().info("print_settings.resolution={}", resolution); //TODO: Return 72 (1/72 inch = 1 point) until gtk bug 346245 is fixed //TODO: Fix this: gtk_print_settings_get_resolution returns 0? (see gtk bug 346252) if (true || resolution is 0) return new Point(72, 72); diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/program/Program.d --- a/dwt/program/Program.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/program/Program.d Fri Mar 20 21:00:06 2009 +0100 @@ -32,7 +32,7 @@ } else { import tango.io.FileConduit; } -import tango.text.stream.LineIterator; +import tango.io.stream.Lines; version( build ){ pragma(link, "gnomeui-2" ); @@ -602,7 +602,7 @@ scope file = new tango.io.device.File.File ("/usr/share/mime/globs"); else scope file = new FileConduit ("/usr/share/mime/globs"); - scope it = new LineIterator!(char)(file); + scope it = new Lines!(char)(file); // process file one line at a time String[][ String ] mimeInfo; foreach (line; it ){ diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/widgets/Button.d --- a/dwt/widgets/Button.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/widgets/Button.d Fri Mar 20 21:00:06 2009 +0100 @@ -26,7 +26,6 @@ import dwt.widgets.TypedListener; import dwt.widgets.Decorations; -import tango.io.Stdout; /** * Instances of this class represent a selectable user interface object that diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/widgets/Composite.d --- a/dwt/widgets/Composite.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/widgets/Composite.d Fri Mar 20 21:00:06 2009 +0100 @@ -33,8 +33,6 @@ import dwt.graphics.Rectangle; import dwt.dwthelper.utils; -import tango.io.Stdout; - /** * Instances of this class are controls which are capable * of containing other controls. diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/widgets/Control.d --- a/dwt/widgets/Control.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/widgets/Control.d Fri Mar 20 21:00:06 2009 +0100 @@ -58,7 +58,6 @@ import Math = tango.math.Math; import tango.core.Thread; -import tango.io.Stdout; /** diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/widgets/Display.d --- a/dwt/widgets/Display.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/widgets/Display.d Fri Mar 20 21:00:06 2009 +0100 @@ -48,7 +48,6 @@ import dwt.dwthelper.Runnable; import tango.core.Thread; -import tango.io.Stdout; /** * Instances of this class are responsible for managing the @@ -614,7 +613,7 @@ OS.gtk_container_forall (cast(GtkContainer*)widget, cast(GtkCallback)&allChildrenProcFunc, &allChildrenProcCallbackData); } private static extern(C) int /*long*/ allChildrenProcFunc (GtkWidget* handle, void* user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast(CallbackData*)user_data; return cbdata.display.allChildrenProc( cast(GtkWidget*)handle, cast(int)cbdata.data ); } @@ -746,7 +745,7 @@ GtkTreeIter *iter, void* data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast(CallbackData*)data; return cbdata.display.cellDataProc( tree_column, cell, tree_model, iter, cbdata.data ); } @@ -781,7 +780,7 @@ } private static extern(C) int checkIfEventProcFunc (void* display, XEvent* xEvent, char* userData) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; auto disp = cast(Display)userData; return disp.checkIfEventProcMeth( display, xEvent ); } @@ -916,7 +915,7 @@ } private static extern(C) int XErrorHandler( void*, XErrorEvent* ){ - Stdout.formatln ("*** XError" ); + getDwtLogger().error ("*** XError" ); byte* p; *p = 3; return 0; @@ -940,10 +939,10 @@ char* ptr = OS.gtk_check_version (MAJOR, MINOR, MICRO); if (ptr !is null) { char [] buffer = fromStringz(ptr); - Stdout.formatln ("***WARNING: {}", buffer ); - Stdout.formatln ("***WARNING: DWT requires GTK {}.{}.{}", MAJOR, MINOR, MICRO ); + getDwtLogger().warn ("***WARNING: {}", buffer ); + getDwtLogger().warn ("***WARNING: DWT requires GTK {}.{}.{}", MAJOR, MINOR, MICRO ); int major = OS.gtk_major_version (), minor = OS.gtk_minor_version (), micro = OS.gtk_micro_version (); - Stdout.formatln ("***WARNING: Detected: {}.{}.{}", major, minor, micro); + getDwtLogger().warn ("***WARNING: Detected: {}.{}.{}", major, minor, micro); } if (fixed_type is 0) { GTypeInfo* fixed_info = new GTypeInfo (); @@ -1205,7 +1204,7 @@ } private static extern(C) void eventProcFunc (GdkEvent* event, void* data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; Display disp = cast(Display)data; disp.eventProcMeth(event); } @@ -1320,7 +1319,7 @@ } private static extern(C) void fixedClassInitProcFunc (void* g_class, void* class_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; GtkWidgetClass* klass = cast(GtkWidgetClass*)g_class; klass.map = &fixedMapProcFunc; oldFixedSizeAllocateProc = klass.size_allocate; @@ -1328,7 +1327,7 @@ } private static extern(C) void fixedMapProcFunc (GtkWidget * handle) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; Display display = getCurrent (); Widget widget = display.getWidget (handle); if (widget !is null) widget.fixedMapProc (handle); @@ -1342,7 +1341,7 @@ } private static extern(C) void rendererClassInitProcFunc (void* g_class, void* class_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; GtkCellRendererClass* klass = cast(GtkCellRendererClass*)g_class; klass.render = &rendererRenderProcFunc; klass.get_size = &rendererGetSizeProcFunc; @@ -1357,13 +1356,13 @@ int *width, int *height) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; Display display = getCurrent (); Widget widget = display.getWidget (handle); if (widget !is null) widget.rendererGetSizeProc (cell, handle, cell_area, x_offset, y_offset, width, height); } private static extern(C) void rendererRenderProcFunc(GtkCellRenderer * cell, GdkDrawable * window, GtkWidget * handle, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, int flags){ - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; Display display = getCurrent (); Widget widget = display.getWidget (handle); if (widget !is null) widget.rendererRenderProc (cell, window, handle, background_area, cell_area, expose_area, flags); @@ -1516,7 +1515,7 @@ } private static extern(C) int filterProcFunc (GdkXEvent* xEvent, GdkEvent* gdkEvent, void* data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; auto callbackdata = cast(CallbackData*)data; auto disp = callbackdata.display; if( disp is null ) return 0; @@ -2355,7 +2354,7 @@ } private static extern(C) int idleProcFunc (void* data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; auto dbdata = cast(CallbackData*)data; return dbdata.display.idleProc(); } @@ -2797,7 +2796,7 @@ } private static extern(C) void menuPositionProcFunc (GtkMenu* menu, int* x, int* y, int* push_in, void* user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; auto display = cast(Display)user_data; display.menuPositionProc( menu, x, y, push_in, null ); } @@ -2876,7 +2875,7 @@ } private static extern(C) int /*long*/ mouseHoverProcFunc ( void* user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast(CallbackData*)user_data; return cbdata.display.mouseHoverProc( cast(GtkWidget*)cbdata.data ); } @@ -3650,7 +3649,7 @@ } package static extern(C) int /*long*/ setDirectionProcFunc (GtkWidget* widget, void* data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast(CallbackData*)data; return cbdata.display.setDirectionProc( widget, cast(int)cbdata.data ); } @@ -3899,7 +3898,7 @@ private static extern(C) int timerProcFunc ( void * data ) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast( CallbackData* ) data; return cbdata.display.timerProc( cast(int) cbdata.data ); } @@ -3917,7 +3916,7 @@ } private static extern(C) int caretProcFunc ( void * data ) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast( CallbackData* ) data; return cbdata.display.caretProc( cast(int) cbdata.data ); } @@ -3946,7 +3945,7 @@ } private static extern(C) void sizeAllocateProcFunc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; auto cbdata = cast(CallbackData*)user_data; cbdata.display.sizeAllocateProc( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data ); } @@ -3965,7 +3964,7 @@ } private static extern(C) void sizeRequestProcFunc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; auto cbdata = cast(CallbackData*)user_data; cbdata.display.sizeRequestProcMeth( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data ); } @@ -3983,7 +3982,7 @@ } private static extern(C) void treeSelectionProcFunc (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, void* data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; auto cbdata = cast(CallbackData*)data; cbdata.display.treeSelectionProcMeth( model, path, iter, cbdata.data ); } @@ -4049,7 +4048,7 @@ } private static extern(C) int /*long*/ shellMapProcFunc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; auto cbdata = cast(CallbackData*)user_data; return cbdata.display.shellMapProc( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data ); } @@ -4061,7 +4060,7 @@ } private static extern(C) int /*long*/ styleSetProcFunc (int /*long*/ gobject, int /*long*/ arg1, int /*long*/ user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; auto cbdata = cast(CallbackData*)user_data; return cbdata.display.styleSetProcMeth( gobject, arg1, cast(int)cbdata.data ); } @@ -4178,7 +4177,7 @@ } private static extern(C) int /*long*/ windowProcFunc2 (GtkWidget* handle, int /*long*/ user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast(CallbackData*)user_data; return cbdata.display.windowProc( handle, cast(int)cbdata.data ); } @@ -4189,7 +4188,7 @@ } private static extern(C) int /*long*/ windowProcFunc3 (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast(CallbackData*)user_data; return cbdata.display.windowProc( cast(GtkWidget*)handle, arg0, cast(int)cbdata.data ); } @@ -4200,7 +4199,7 @@ } private static extern(C) int /*long*/ windowProcFunc4 (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast(CallbackData*)user_data; return cbdata.display.windowProc( cast(GtkWidget*)handle, arg0, arg1, cast(int)cbdata.data ); } @@ -4211,7 +4210,7 @@ } private static extern(C) int /*long*/ windowProcFunc5 (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; CallbackData* cbdata = cast(CallbackData*)user_data; return cbdata.display.windowProc( cast(GtkWidget*)handle, arg0, arg1, arg2, cast(int)cbdata.data ); } @@ -4226,7 +4225,7 @@ return OS.gtk_timeout_add (delay, &windowTimerProcFunc, widget); } private static extern(C) int /*long*/ windowTimerProcFunc (void* user_data) { - version(LOG) Stderr.formatln( "Display {}:", __LINE__ ).flush; + version(LOG) getDwtLogger().error( "Display {}:", __LINE__ ).flush; Display d = cast(Display) OS.g_object_get_data(cast(GObject*)user_data, Display.classinfo.name.ptr ); return d.windowTimerProc( cast(GtkWidget*)user_data ); } diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/widgets/ProgressBar.d --- a/dwt/widgets/ProgressBar.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/widgets/ProgressBar.d Fri Mar 20 21:00:06 2009 +0100 @@ -23,7 +23,6 @@ import dwt.widgets.Display; import Math = tango.math.Math; -import tango.io.Stdout; /** * Instances of the receiver represent an unselectable diff -r ee1dd551f5b1 -r 4bffbf81e2d6 dwt/widgets/Widget.d --- a/dwt/widgets/Widget.d Fri Mar 20 20:30:32 2009 +0100 +++ b/dwt/widgets/Widget.d Fri Mar 20 21:00:06 2009 +0100 @@ -28,10 +28,6 @@ import tango.stdc.string; import tango.core.Thread; -//version=LOG; -version(LOG){ - import tango.io.Stdout; -} /** * This class is the abstract superclass of all user interface objects. @@ -1625,7 +1621,7 @@ int /*long*/ windowProc (GtkWidget* handle, int /*long*/ user_data) { void trace( String str ){ - version(LOG) Stderr.formatln( "Widget windowProc {}", str ).flush; + version(LOG) getDwtLogger().error( "Widget windowProc {}", str ).flush; } switch (cast(int)/*64*/user_data) { @@ -1688,7 +1684,7 @@ int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { void trace( String str ){ - version(LOG) Stderr.formatln( "Widget windowProc1 {}", str ).flush; + version(LOG) getDwtLogger().error( "Widget windowProc1 {}", str ).flush; } switch (cast(int)/*64*/user_data) { @@ -1801,7 +1797,7 @@ int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) { void trace( String str ){ - version(LOG) Stderr.formatln( "Widget windowProc2 {}", str ).flush; + version(LOG) getDwtLogger().error( "Widget windowProc2 {}", str ).flush; } switch (cast(int)/*64*/user_data) { @@ -1835,7 +1831,7 @@ int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) { void trace( String str ){ - version(LOG) Stderr.formatln( "Widget windowProc3 {}", str ).flush; + version(LOG) getDwtLogger().error( "Widget windowProc3 {}", str ).flush; } switch (cast(int)/*64*/user_data) {