changeset 248:d10ff1f47f84

Add: version TANGOSVN
author Frank Benoit <benoit@tionex.de>
date Sun, 06 Jul 2008 16:42:54 +0200
parents 32a6819fef61
children 55591bc3974c
files dwt/dwthelper/ByteArrayOutputStream.d dwt/dwthelper/File.d dwt/dwthelper/InflaterInputStream.d dwt/dwthelper/Runnable.d dwt/dwthelper/System.d dwt/dwthelper/utils.d
diffstat 6 files changed, 102 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/dwthelper/ByteArrayOutputStream.d	Tue Jun 24 22:05:28 2008 +0200
+++ b/dwt/dwthelper/ByteArrayOutputStream.d	Sun Jul 06 16:42:54 2008 +0200
@@ -5,7 +5,13 @@
 
 public import dwt.dwthelper.OutputStream;
 import dwt.dwthelper.utils;
-import tango.io.GrowBuffer;
+import tango.io.Buffer;
+version(TANGOSVN) {
+    import tango.io.Buffer;
+}
+else{
+    import tango.io.GrowBuffer;
+}
 
 public class ByteArrayOutputStream : dwt.dwthelper.OutputStream.OutputStream {
 
--- a/dwt/dwthelper/File.d	Tue Jun 24 22:05:28 2008 +0200
+++ b/dwt/dwthelper/File.d	Sun Jul 06 16:42:54 2008 +0200
@@ -5,7 +5,12 @@
 
 import dwt.dwthelper.utils;
 
-static import tango.io.FileConst;
+version(TANGOSVN) {
+    static import tango.io.model.IFile;
+}
+else{
+    static import tango.io.FileConst;
+}
 static import tango.io.FilePath;
 static import tango.io.FileSystem;
 
@@ -19,10 +24,18 @@
     private tango.io.FilePath.FilePath mFilePath;
 
     static this(){
+version(TANGOSVN) {
+        separator = tango.io.model.IFile.FileConst.PathSeparatorString;
+        separatorChar = tango.io.model.IFile.FileConst.PathSeparatorChar;
+        pathSeparator = tango.io.model.IFile.FileConst.SystemPathString;
+        pathSeparatorChar = tango.io.model.IFile.FileConst.SystemPathChar;
+}
+else{
         separator = tango.io.FileConst.FileConst.PathSeparatorString;
         separatorChar = tango.io.FileConst.FileConst.PathSeparatorChar;
         pathSeparator = tango.io.FileConst.FileConst.SystemPathString;
         pathSeparatorChar = tango.io.FileConst.FileConst.SystemPathChar;
+}
     }
 
     public this ( String pathname ){
--- a/dwt/dwthelper/InflaterInputStream.d	Tue Jun 24 22:05:28 2008 +0200
+++ b/dwt/dwthelper/InflaterInputStream.d	Sun Jul 06 16:42:54 2008 +0200
@@ -5,6 +5,42 @@
 
 public import dwt.dwthelper.InputStream;
 import dwt.dwthelper.utils;
+import tango.io.Stdout;
+import tango.io.compress.ZlibStream;
+version(TANGOSVN) {
+    import tango.io.Conduit;
+}
+class InputStreamWrapper : tango.io.model.IConduit.InputStream {
+
+    dwt.dwthelper.InputStream.InputStream istr;
+
+    this( dwt.dwthelper.InputStream.InputStream istr ){
+        this.istr = istr;
+    }
+
+    uint read (void[] dst){
+        int res = istr.read( cast(byte[])dst );
+        return res;
+    }
+version(TANGOSVN) {
+    void[] load (void[] dst = null) {
+            return Conduit.load (this, dst);
+    }
+}
+
+
+    tango.io.model.IConduit.InputStream clear (){
+        return this;
+    }
+
+    tango.io.model.IConduit.IConduit conduit (){
+        return null;
+    }
+
+    void close (){
+        istr.close();
+    }
+}
 
 public class InflaterInputStream : dwt.dwthelper.InputStream.InputStream {
 
@@ -20,12 +56,19 @@
     protected int len;
     package bool usesDefaultInflater = false;
 
+    ZlibInput tangoIstr;
+
     public this ( dwt.dwthelper.InputStream.InputStream istr ){
+        tangoIstr = new ZlibInput( new InputStreamWrapper(istr ));
     }
 
     public int read(){
-        implMissing( __FILE__, __LINE__ );
-        return 0;
+        ubyte[1] data;
+        uint res = tangoIstr.read( data );
+        if( res !is 1 ){
+            return data[0] & 0xFF;
+        }
+        return -1;
     }
 
     public int read( byte[] b, int off, int len ){
--- a/dwt/dwthelper/Runnable.d	Tue Jun 24 22:05:28 2008 +0200
+++ b/dwt/dwthelper/Runnable.d	Sun Jul 06 16:42:54 2008 +0200
@@ -1,4 +1,4 @@
-/**
+/**
  * Authors: Frank Benoit <benoit@tionex.de>
  */
 module dwt.dwthelper.Runnable;
--- a/dwt/dwthelper/System.d	Tue Jun 24 22:05:28 2008 +0200
+++ b/dwt/dwthelper/System.d	Sun Jul 06 16:42:54 2008 +0200
@@ -3,12 +3,12 @@
  */
 module dwt.dwthelper.System;
 
+import dwt.dwthelper.utils;
+
 import tango.core.Exception;
 import tango.time.Clock;
 import tango.stdc.stdlib : exit;
 
-import dwt.dwthelper.utils;
-
 template SimpleType(T) {
     debug{
         static void validCheck(uint SrcLen, uint DestLen, uint copyLen){
@@ -124,7 +124,7 @@
     alias SimpleType!(ushort[]).arraycopy arraycopy;
     alias SimpleType!(ubyte[]).arraycopy arraycopy;
     alias SimpleType!(ulong[]).arraycopy arraycopy;
-    alias SimpleType!(char[]).arraycopy arraycopy;
+    alias SimpleType!(String).arraycopy arraycopy;
     alias SimpleType!(wchar[]).arraycopy arraycopy;
     alias SimpleType!(Object[]).arraycopy arraycopy;
     alias SimpleType!(void*[]).arraycopy arraycopy;
@@ -146,7 +146,7 @@
 
     public static String getProperty( String key ){
         switch( key ){
-        case "os.name": return "windows";
+        case "os.name": return "linux";
         default: return null;
         }
     }
--- a/dwt/dwthelper/utils.d	Tue Jun 24 22:05:28 2008 +0200
+++ b/dwt/dwthelper/utils.d	Sun Jul 06 16:42:54 2008 +0200
@@ -10,7 +10,7 @@
 
 import tango.io.Stdout;
 import tango.io.Print;
-import tango.stdc.stringz;
+static import tango.stdc.stringz;
 static import tango.text.Util;
 static import tango.text.Text;
 import tango.text.Unicode;
@@ -149,15 +149,30 @@
     }
 
     public static String toHexString( int i ){
+version(TANGOSVN) {
+        return tango.text.convert.Integer.toString(i, "x" );
+}
+else{
         return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex );
+}
     }
 
     public static String toOctalString( int i ){
+version(TANGOSVN) {
+        return tango.text.convert.Integer.toString(i, "o" );
+}
+else{
         return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal );
+}
     }
 
     public static String toBinaryString( int i ){
+version(TANGOSVN) {
+        return tango.text.convert.Integer.toString(i, "b" );
+}
+else{
         return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary );
+}
     }
 
     public static String toString( int i ){
@@ -629,7 +644,21 @@
     }
 }
 
+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){
+version(TANGOSVN) {
+    return tango.text.convert.Integer.toString(
+            value,
+            radix is 10 ? "d" :
+            radix is  8 ? "o" :
+            radix is 16 ? "x" :
+                          "d" );
+}
+else{
     return tango.text.convert.Integer.toString(
             value,
             radix is 10 ? tango.text.convert.Integer.Style.Signed :
@@ -639,6 +668,7 @@
             prefix ? tango.text.convert.Integer.Flags.Prefix : tango.text.convert.Integer.Flags.None
             );
 }
+}
 
 class RuntimeException : Exception {
     this( String e = null){