changeset 360:ee1dd551f5b1

Make compilable for tango 0.99.8
author Frank Benoit <benoit@tionex.de>
date Fri, 20 Mar 2009 20:30:32 +0100
parents fd2409fb852e
children 4bffbf81e2d6
files dwt/dwthelper/ByteArrayOutputStream.d dwt/dwthelper/FileInputStream.d dwt/dwthelper/FileOutputStream.d dwt/dwthelper/InflaterInputStream.d dwt/dwthelper/ResourceBundle.d dwt/dwthelper/System.d
diffstat 6 files changed, 34 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/dwthelper/ByteArrayOutputStream.d	Tue Jan 27 10:15:27 2009 +0100
+++ b/dwt/dwthelper/ByteArrayOutputStream.d	Fri Mar 20 20:30:32 2009 +0100
@@ -5,18 +5,18 @@
 
 public import dwt.dwthelper.OutputStream;
 import dwt.dwthelper.utils;
-import tango.io.Buffer;
+import tango.io.device.Array;
 
 public class ByteArrayOutputStream : dwt.dwthelper.OutputStream.OutputStream {
 
-    protected GrowBuffer buffer;
+    protected Array buffer;
 
     public this (){
-        buffer = new GrowBuffer();
+        buffer = new Array();
     }
 
     public this ( int par_size ){
-        buffer = new GrowBuffer(par_size);
+        buffer = new Array(par_size);
     }
 
     public synchronized override void write( int b ){
--- a/dwt/dwthelper/FileInputStream.d	Tue Jan 27 10:15:27 2009 +0100
+++ b/dwt/dwthelper/FileInputStream.d	Fri Mar 20 20:30:32 2009 +0100
@@ -8,11 +8,10 @@
 import dwt.dwthelper.InputStream;
 
 version(TANGOSVN){
-    import tango.io.device.File;
+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;
 import tango.text.convert.Format;
 
@@ -20,11 +19,7 @@
 
     alias dwt.dwthelper.InputStream.InputStream.read read;
 
-    version(TANGOSVN)
-        private tango.io.device.File.File file_;
-    else
-        private FileConduit conduit;
-        
+    private TangoFile.File conduit;
     private ubyte[] buffer;
     private int buf_pos;
     private int buf_size;
@@ -32,20 +27,13 @@
     private bool eof;
 
     public this ( String name ){
-        version(TANGOSVN)
-            file_ = new tango.io.device.File.File( name );
-        else
-            conduit = new FileConduit( name );
-            
+        conduit = new TangoFile.File( name );
         buffer = new ubyte[]( BUFFER_SIZE );
     }
 
     public this ( dwt.dwthelper.File.File file ){
         implMissing( __FILE__, __LINE__ );
-        version(TANGOSVN)
-            file_ = new tango.io.device.File.File ( file.getAbsolutePath(), tango.io.device.File.File.ReadExisting );
-        else
-            conduit = new FileConduit( file.getAbsolutePath(), FileConduit.ReadExisting );
+        conduit = new TangoFile.File( file.getAbsolutePath(), TangoFile.File.ReadExisting );
         buffer = new ubyte[]( BUFFER_SIZE );
     }
 
@@ -56,10 +44,7 @@
         try{
             if( buf_pos == buf_size ){
                 buf_pos = 0;
-                version(TANGOSVN)
-                    buf_size = file_.read( buffer );
-                else
-                    buf_size = conduit.input.read( buffer );
+                buf_size = conduit.input.read( buffer );
             }
             if( buf_size <= 0 ){
                 eof = true;
@@ -88,10 +73,7 @@
     }
 
     public override void close(){
-        version(TANGOSVN)
-            file_.close();
-        else
-            conduit.close();
+        conduit.close();
     }
 }
 
--- a/dwt/dwthelper/FileOutputStream.d	Tue Jan 27 10:15:27 2009 +0100
+++ b/dwt/dwthelper/FileOutputStream.d	Fri Mar 20 20:30:32 2009 +0100
@@ -9,33 +9,23 @@
 import dwt.dwthelper.utils;
 
 version(TANGOSVN){
-import tango.io.device.File;
+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;
-    
-    version(TANGOSVN)
-        tango.io.device.File.File fc;
-    else
-        FileConduit fc;
+    TangoFile.File fc;
     
     public this ( String name ){
-        version(TANGOSVN)
-            fc = new tango.io.device.File.File( name, tango.io.device.File.File.WriteCreate );
-        else
-            fc = new FileConduit( name, FileConduit.WriteCreate );
+        fc = new TangoFile.File( name, TangoFile.File.WriteCreate );
     }
 
     public this ( String name, bool append ){
-        version(TANGOSVN)
-            fc = new tango.io.device.File.File( name, append ? tango.io.device.File.File.WriteAppending : tango.io.device.File.File.WriteCreate );
-        else    
-            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:15:27 2009 +0100
+++ b/dwt/dwthelper/InflaterInputStream.d	Fri Mar 20 20:30:32 2009 +0100
@@ -30,19 +30,19 @@
         int res = istr.read( cast(byte[])dst );
         return res;
     }
-    void[] load (void[] dst = null) {
-            return Conduit.load (this, dst);
+
+    IOStream flush () {
+            return this;
+    }
+
+    void[] load ( size_t max = -1 ) {
+            return Conduit.load (this, max);
     }
 
     tango.io.model.IConduit.InputStream clear (){
         return this;
     }
 
-    long seek ( long offset, IOStream.Anchor anchor = IOStream.Anchor.Begin )
-    {
-        throw new IOException(__FILE__ ~ "seek method not implemented");
-    }
-    
     tango.io.model.IConduit.IConduit conduit (){
         return null;
     }
@@ -50,9 +50,11 @@
     void close (){
         istr.close();
     }
-    
-    tango.io.model.IConduit.InputStream input() {
-        return this; //??
+    tango.io.model.IConduit.InputStream input (){
+        return null;
+    }
+    long seek (long offset, Anchor anchor = Anchor.Begin){
+        return 0;
     }
 }
 
--- a/dwt/dwthelper/ResourceBundle.d	Tue Jan 27 10:15:27 2009 +0100
+++ b/dwt/dwthelper/ResourceBundle.d	Fri Mar 20 20:30:32 2009 +0100
@@ -8,11 +8,9 @@
 
 import dwt.DWT;
 import dwt.dwthelper.utils;
-import tango.io.File;
+import tango.io.device.File;
 import tango.text.locale.Core;
 
-import tango.util.log.Trace;
-
 class ResourceBundle {
 
     String[ String ] map;
@@ -27,7 +25,7 @@
             char[] end = "_" ~ name ~ ".properties";
             foreach( entry; data ){
                 if( entry.name.length > end.length && entry.name[ $-end.length .. $ ] == end ){
-                    Trace.formatln( "ResourceBundle {}", entry.name );
+                    //Trace.formatln( "ResourceBundle {}", entry.name );
                     initialize( cast(char[])entry.data );
                     return;
                 }
@@ -36,12 +34,12 @@
         char[] end = "_" ~ name[0..2] ~ ".properties";
         foreach( entry; data ){
             if( entry.name.length > end.length && entry.name[ $-end.length .. $ ] == end ){
-                Trace.formatln( "ResourceBundle {}", entry.name );
+                //Trace.formatln( "ResourceBundle {}", entry.name );
                 initialize( cast(char[])entry.data );
                 return;
             }
         }
-        Trace.formatln( "ResourceBundle default" );
+        //Trace.formatln( "ResourceBundle default" );
         initialize( cast(char[])data[0].data );
     }
     public this( ImportData data ){
@@ -170,8 +168,7 @@
     }
     public static ResourceBundle getBundle( String name ){
         try{
-            scope f = new File(name);
-            return new ResourceBundle( cast(String) f.read() );
+            return new ResourceBundle( cast(String) File.get(name) );
         }
         catch( IOException e){
             e.msg ~= " file:" ~ name;
--- a/dwt/dwthelper/System.d	Tue Jan 27 10:15:27 2009 +0100
+++ b/dwt/dwthelper/System.d	Fri Mar 20 20:30:32 2009 +0100
@@ -158,9 +158,7 @@
     public static String getProperty( String key ){
         /* get values for global system keys (environment) */
         switch( key ) {
-            // Ubuntu Gutsy:Environment.get for OSTYPE is not working
-            // Force default to "linux" for now -JJR
-            case "os.name": return Environment.get("OSTYPE","linux");
+            case "os.name": return "linux";// Environment.get("OSTYPE");
             case "user.name": return Environment.get("USER");
             case "user.home": return Environment.get("HOME");
             case "user.dir" : return Environment.get("PWD");