changeset 332:1ee938a6e02e

Tango updates, removing trace prints and added prints via Logger
author Frank Benoit <benoit@tionex.de>
date Sun, 01 Feb 2009 19:40:09 +0100
parents 27479f54069d
children 684eed7589a0
files dwt/dwthelper/FileInputStream.d dwt/dwthelper/FileOutputStream.d dwt/dwthelper/InflaterInputStream.d dwt/dwthelper/utils.d dwt/internal/gdip/native.d dwt/internal/win32/OS.d
diffstat 6 files changed, 39 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/dwthelper/FileInputStream.d	Tue Jan 27 10:40:55 2009 +0100
+++ b/dwt/dwthelper/FileInputStream.d	Sun Feb 01 19:40:09 2009 +0100
@@ -8,9 +8,9 @@
 import dwt.dwthelper.InputStream;
 
 version(TANGOSVN){
-import tango.io.device.FileConduit;
+import TangoFile = tango.io.device.File;
 } else {
-import tango.io.FileConduit;
+import TangoFile = tango.io.FileConduit;
 }
 import tango.io.protocol.Reader;
 import tango.core.Exception;
@@ -20,7 +20,7 @@
 
     alias dwt.dwthelper.InputStream.InputStream.read read;
 
-    private FileConduit conduit;
+    private TangoFile.File conduit;
     private ubyte[] buffer;
     private int buf_pos;
     private int buf_size;
@@ -28,13 +28,13 @@
     private bool eof;
 
     public this ( String name ){
-        conduit = new FileConduit( name );
+        conduit = new TangoFile.File( name );
         buffer = new ubyte[]( BUFFER_SIZE );
     }
 
     public this ( dwt.dwthelper.File.File file ){
         implMissing( __FILE__, __LINE__ );
-        conduit = new FileConduit( file.getAbsolutePath(), FileConduit.ReadExisting );
+        conduit = new TangoFile.File( file.getAbsolutePath(), TangoFile.File.ReadExisting );
         buffer = new ubyte[]( BUFFER_SIZE );
     }
 
--- a/dwt/dwthelper/FileOutputStream.d	Tue Jan 27 10:40:55 2009 +0100
+++ b/dwt/dwthelper/FileOutputStream.d	Sun Feb 01 19:40:09 2009 +0100
@@ -9,23 +9,23 @@
 import dwt.dwthelper.utils;
 
 version(TANGOSVN){
-import tango.io.device.FileConduit;
+import TangoFile = tango.io.device.File;
 } else {
-import tango.io.FileConduit;
+import TangoFile = tango.io.FileConduit;
 }
 
 public class FileOutputStream : dwt.dwthelper.OutputStream.OutputStream {
 
     alias dwt.dwthelper.OutputStream.OutputStream.write write;
     alias dwt.dwthelper.OutputStream.OutputStream.close close;
-    FileConduit fc;
+    TangoFile.File fc;
     
     public this ( String name ){
-        fc = new FileConduit( name, FileConduit.WriteCreate );
+        fc = new TangoFile.File( name, TangoFile.File.WriteCreate );
     }
 
     public this ( String name, bool append ){
-        fc = new FileConduit( name, append ? FileConduit.WriteAppending : FileConduit.WriteCreate );
+        fc = new TangoFile.File( name, append ? TangoFile.File.WriteAppending : TangoFile.File.WriteCreate );
     }
 
     public this ( dwt.dwthelper.File.File file ){
--- a/dwt/dwthelper/InflaterInputStream.d	Tue Jan 27 10:40:55 2009 +0100
+++ b/dwt/dwthelper/InflaterInputStream.d	Sun Feb 01 19:40:09 2009 +0100
@@ -45,6 +45,12 @@
     void close (){
         istr.close();
     }
+    tango.io.model.IConduit.InputStream input (){
+        return null;
+    }
+    long seek (long offset, Anchor anchor = Anchor.Begin){
+        return 0;
+    }
 }
 
 public class InflaterInputStream : dwt.dwthelper.InputStream.InputStream {
--- a/dwt/dwthelper/utils.d	Tue Jan 27 10:40:55 2009 +0100
+++ b/dwt/dwthelper/utils.d	Sun Feb 01 19:40:09 2009 +0100
@@ -21,8 +21,13 @@
 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;
 
@@ -53,6 +58,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 {
@@ -476,8 +486,8 @@
     return res.length;
 }
 
-alias tango.text.convert.Utf.toString16 toString16;
-alias tango.text.convert.Utf.toString toString;
+//alias tango.text.convert.Utf.toString16 toString16;
+//alias tango.text.convert.Utf.toString toString;
 
 int toAbsoluteCodePointStartOffset( String str, int index ){
     //Trace.formatln( "str={}, str.length={}, index={}", str, str.length, index );
@@ -1067,7 +1077,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 );
--- a/dwt/internal/gdip/native.d	Tue Jan 27 10:40:55 2009 +0100
+++ b/dwt/internal/gdip/native.d	Sun Feb 01 19:40:09 2009 +0100
@@ -14,7 +14,7 @@
 
 import dwt.internal.win32.WINTYPES;
 import tango.sys.SharedLib : SharedLib;
-import tango.util.log.Trace;
+import dwt.dwthelper.utils;
 
 extern(Windows):
 
@@ -1681,11 +1681,11 @@
         foreach( inout s; symbols ){
             *s.symbol = lib.getSymbol( s.name.ptr );
             if( s.symbol is null ){
-                Trace.formatln("gdiplus.dll: Symbol '{}' not found", s.name );
+                getDwtLogger.error("gdiplus.dll: Symbol '{}' not found", s.name );
             }
         }
     } else {
-        Trace.formatln("Could not load the library gdiplus.dll");
+        getDwtLogger.error("Could not load the library gdiplus.dll");
     }
 }
 
--- a/dwt/internal/win32/OS.d	Tue Jan 27 10:40:55 2009 +0100
+++ b/dwt/internal/win32/OS.d	Sun Feb 01 19:40:09 2009 +0100
@@ -27,6 +27,7 @@
 
 import dwt.internal.C;
 import dwt.internal.Library;
+import dwt.dwthelper.utils;
 import tango.sys.SharedLib : SharedLib;
 import tango.sys.Common : SysError;
 static import tango.stdc.stdlib;
@@ -38,10 +39,9 @@
 import tango.io.File;
 
 
-import tango.util.log.Trace;
 import tango.io.Console;
 void trace(int line ){
-    //Trace.formatln( "OS {}", line );
+    getDwtLogger.trace( "OS {}", line );
 }
 
 // declare of Callback functions
@@ -100,12 +100,12 @@
                 if( OS.WIN32_VERSION >= OS.VERSION( s.major, s.minor )){
                     *s.symbol = lib.getSymbol( s.name.ptr );
                     if( s.symbol is null ){
-                        Trace.formatln( "{}: Symbol '{}' not found", libname, s.name );
+                        getDwtLogger.error( "{}: Symbol '{}' not found", libname, s.name );
                     }
                 }
             }
         } else {
-            Trace.formatln( "Could not load the library {}", libname );
+            getDwtLogger.error( "Could not load the library {}", libname );
         }
     }
 
@@ -413,7 +413,7 @@
         void printError( char[] msg ){
             char[] winMsg = SysError.lastMsg();
             char[2000] buf;
-            Trace.formatln("{}: {}", msg, CodePage.from( winMsg, buf ) );
+            getDwtLogger.error("{}: {}", msg, CodePage.from( winMsg, buf ) );
         }
         TCHAR[] buffer = new TCHAR[ MAX_PATH ];
         buffer[] = 0;
@@ -2721,12 +2721,12 @@
             if( OS.WIN32_VERSION >= OS.VERSION( s.major, s.minor )){
                 *s.symbol = lib.getSymbol( s.name.ptr );
                 if( *s.symbol is null ){
-                    Trace.formatln("UxTheme.dll: Symbol '{}' not found", s.name );
+                    getDwtLogger.error("UxTheme.dll: Symbol '{}' not found", s.name );
                 }
             }
         }
     } else {
-        Trace.formatln("Could not load the library UxTheme.dll");
+        getDwtLogger.error("Could not load the library UxTheme.dll");
     }
 }
 //----------------------------------------------------------------------