Changeset 248:d10ff1f47f84
- Timestamp:
- 07/06/08 10:42:54
(3 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Add: version TANGOSVN
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r242 |
r248 |
|
| 6 | 6 | public import dwt.dwthelper.OutputStream; |
|---|
| 7 | 7 | import dwt.dwthelper.utils; |
|---|
| 8 | | import tango.io.GrowBuffer; |
|---|
| | 8 | import tango.io.Buffer; |
|---|
| | 9 | version(TANGOSVN) { |
|---|
| | 10 | import tango.io.Buffer; |
|---|
| | 11 | } |
|---|
| | 12 | else{ |
|---|
| | 13 | import tango.io.GrowBuffer; |
|---|
| | 14 | } |
|---|
| 9 | 15 | |
|---|
| 10 | 16 | public class ByteArrayOutputStream : dwt.dwthelper.OutputStream.OutputStream { |
|---|
| r212 |
r248 |
|
| 6 | 6 | import dwt.dwthelper.utils; |
|---|
| 7 | 7 | |
|---|
| 8 | | static import tango.io.FileConst; |
|---|
| | 8 | version(TANGOSVN) { |
|---|
| | 9 | static import tango.io.model.IFile; |
|---|
| | 10 | } |
|---|
| | 11 | else{ |
|---|
| | 12 | static import tango.io.FileConst; |
|---|
| | 13 | } |
|---|
| 9 | 14 | static import tango.io.FilePath; |
|---|
| 10 | 15 | static import tango.io.FileSystem; |
|---|
| … | … | |
| 20 | 25 | |
|---|
| 21 | 26 | static this(){ |
|---|
| | 27 | version(TANGOSVN) { |
|---|
| | 28 | separator = tango.io.model.IFile.FileConst.PathSeparatorString; |
|---|
| | 29 | separatorChar = tango.io.model.IFile.FileConst.PathSeparatorChar; |
|---|
| | 30 | pathSeparator = tango.io.model.IFile.FileConst.SystemPathString; |
|---|
| | 31 | pathSeparatorChar = tango.io.model.IFile.FileConst.SystemPathChar; |
|---|
| | 32 | } |
|---|
| | 33 | else{ |
|---|
| 22 | 34 | separator = tango.io.FileConst.FileConst.PathSeparatorString; |
|---|
| 23 | 35 | separatorChar = tango.io.FileConst.FileConst.PathSeparatorChar; |
|---|
| 24 | 36 | pathSeparator = tango.io.FileConst.FileConst.SystemPathString; |
|---|
| 25 | 37 | pathSeparatorChar = tango.io.FileConst.FileConst.SystemPathChar; |
|---|
| | 38 | } |
|---|
| 26 | 39 | } |
|---|
| 27 | 40 | |
|---|
| r0 |
r248 |
|
| 6 | 6 | public import dwt.dwthelper.InputStream; |
|---|
| 7 | 7 | import dwt.dwthelper.utils; |
|---|
| | 8 | import tango.io.Stdout; |
|---|
| | 9 | import tango.io.compress.ZlibStream; |
|---|
| | 10 | version(TANGOSVN) { |
|---|
| | 11 | import tango.io.Conduit; |
|---|
| | 12 | } |
|---|
| | 13 | class InputStreamWrapper : tango.io.model.IConduit.InputStream { |
|---|
| | 14 | |
|---|
| | 15 | dwt.dwthelper.InputStream.InputStream istr; |
|---|
| | 16 | |
|---|
| | 17 | this( dwt.dwthelper.InputStream.InputStream istr ){ |
|---|
| | 18 | this.istr = istr; |
|---|
| | 19 | } |
|---|
| | 20 | |
|---|
| | 21 | uint read (void[] dst){ |
|---|
| | 22 | int res = istr.read( cast(byte[])dst ); |
|---|
| | 23 | return res; |
|---|
| | 24 | } |
|---|
| | 25 | version(TANGOSVN) { |
|---|
| | 26 | void[] load (void[] dst = null) { |
|---|
| | 27 | return Conduit.load (this, dst); |
|---|
| | 28 | } |
|---|
| | 29 | } |
|---|
| | 30 | |
|---|
| | 31 | |
|---|
| | 32 | tango.io.model.IConduit.InputStream clear (){ |
|---|
| | 33 | return this; |
|---|
| | 34 | } |
|---|
| | 35 | |
|---|
| | 36 | tango.io.model.IConduit.IConduit conduit (){ |
|---|
| | 37 | return null; |
|---|
| | 38 | } |
|---|
| | 39 | |
|---|
| | 40 | void close (){ |
|---|
| | 41 | istr.close(); |
|---|
| | 42 | } |
|---|
| | 43 | } |
|---|
| 8 | 44 | |
|---|
| 9 | 45 | public class InflaterInputStream : dwt.dwthelper.InputStream.InputStream { |
|---|
| … | … | |
| 21 | 57 | package bool usesDefaultInflater = false; |
|---|
| 22 | 58 | |
|---|
| | 59 | ZlibInput tangoIstr; |
|---|
| | 60 | |
|---|
| 23 | 61 | public this ( dwt.dwthelper.InputStream.InputStream istr ){ |
|---|
| | 62 | tangoIstr = new ZlibInput( new InputStreamWrapper(istr )); |
|---|
| 24 | 63 | } |
|---|
| 25 | 64 | |
|---|
| 26 | 65 | public int read(){ |
|---|
| 27 | | implMissing( __FILE__, __LINE__ ); |
|---|
| 28 | | return 0; |
|---|
| | 66 | ubyte[1] data; |
|---|
| | 67 | uint res = tangoIstr.read( data ); |
|---|
| | 68 | if( res !is 1 ){ |
|---|
| | 69 | return data[0] & 0xFF; |
|---|
| | 70 | } |
|---|
| | 71 | return -1; |
|---|
| 29 | 72 | } |
|---|
| 30 | 73 | |
|---|
| r206 |
r248 |
|
| 1 | | /** |
|---|
| | 1 | /** |
|---|
| 2 | 2 | * Authors: Frank Benoit <benoit@tionex.de> |
|---|
| 3 | 3 | */ |
|---|
| r225 |
r248 |
|
| 4 | 4 | module dwt.dwthelper.System; |
|---|
| 5 | 5 | |
|---|
| | 6 | import dwt.dwthelper.utils; |
|---|
| | 7 | |
|---|
| 6 | 8 | import tango.core.Exception; |
|---|
| 7 | 9 | import tango.time.Clock; |
|---|
| 8 | 10 | import tango.stdc.stdlib : exit; |
|---|
| 9 | | |
|---|
| 10 | | import dwt.dwthelper.utils; |
|---|
| 11 | 11 | |
|---|
| 12 | 12 | template SimpleType(T) { |
|---|
| … | … | |
| 125 | 125 | alias SimpleType!(ubyte[]).arraycopy arraycopy; |
|---|
| 126 | 126 | alias SimpleType!(ulong[]).arraycopy arraycopy; |
|---|
| 127 | | alias SimpleType!(char[]).arraycopy arraycopy; |
|---|
| | 127 | alias SimpleType!(String).arraycopy arraycopy; |
|---|
| 128 | 128 | alias SimpleType!(wchar[]).arraycopy arraycopy; |
|---|
| 129 | 129 | alias SimpleType!(Object[]).arraycopy arraycopy; |
|---|
| … | … | |
| 147 | 147 | public static String getProperty( String key ){ |
|---|
| 148 | 148 | switch( key ){ |
|---|
| 149 | | case "os.name": return "windows"; |
|---|
| | 149 | case "os.name": return "linux"; |
|---|
| 150 | 150 | default: return null; |
|---|
| 151 | 151 | } |
|---|
| r235 |
r248 |
|
| 11 | 11 | import tango.io.Stdout; |
|---|
| 12 | 12 | import tango.io.Print; |
|---|
| 13 | | import tango.stdc.stringz; |
|---|
| | 13 | static import tango.stdc.stringz; |
|---|
| 14 | 14 | static import tango.text.Util; |
|---|
| 15 | 15 | static import tango.text.Text; |
|---|
| … | … | |
| 150 | 150 | |
|---|
| 151 | 151 | public static String toHexString( int i ){ |
|---|
| | 152 | version(TANGOSVN) { |
|---|
| | 153 | return tango.text.convert.Integer.toString(i, "x" ); |
|---|
| | 154 | } |
|---|
| | 155 | else{ |
|---|
| 152 | 156 | return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex ); |
|---|
| | 157 | } |
|---|
| 153 | 158 | } |
|---|
| 154 | 159 | |
|---|
| 155 | 160 | public static String toOctalString( int i ){ |
|---|
| | 161 | version(TANGOSVN) { |
|---|
| | 162 | return tango.text.convert.Integer.toString(i, "o" ); |
|---|
| | 163 | } |
|---|
| | 164 | else{ |
|---|
| 156 | 165 | return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal ); |
|---|
| | 166 | } |
|---|
| 157 | 167 | } |
|---|
| 158 | 168 | |
|---|
| 159 | 169 | public static String toBinaryString( int i ){ |
|---|
| | 170 | version(TANGOSVN) { |
|---|
| | 171 | return tango.text.convert.Integer.toString(i, "b" ); |
|---|
| | 172 | } |
|---|
| | 173 | else{ |
|---|
| 160 | 174 | return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary ); |
|---|
| | 175 | } |
|---|
| 161 | 176 | } |
|---|
| 162 | 177 | |
|---|
| … | … | |
| 630 | 645 | } |
|---|
| 631 | 646 | |
|---|
| | 647 | public alias tango.stdc.stringz.toStringz toStringz; |
|---|
| | 648 | public alias tango.stdc.stringz.toString16z toString16z; |
|---|
| | 649 | public alias tango.stdc.stringz.fromStringz fromStringz; |
|---|
| | 650 | public alias tango.stdc.stringz.fromString16z fromString16z; |
|---|
| | 651 | |
|---|
| 632 | 652 | static String toHex(uint value, bool prefix = true, int radix = 8){ |
|---|
| | 653 | version(TANGOSVN) { |
|---|
| | 654 | return tango.text.convert.Integer.toString( |
|---|
| | 655 | value, |
|---|
| | 656 | radix is 10 ? "d" : |
|---|
| | 657 | radix is 8 ? "o" : |
|---|
| | 658 | radix is 16 ? "x" : |
|---|
| | 659 | "d" ); |
|---|
| | 660 | } |
|---|
| | 661 | else{ |
|---|
| 633 | 662 | return tango.text.convert.Integer.toString( |
|---|
| 634 | 663 | value, |
|---|
| … | … | |
| 640 | 669 | ); |
|---|
| 641 | 670 | } |
|---|
| | 671 | } |
|---|
| 642 | 672 | |
|---|
| 643 | 673 | class RuntimeException : Exception { |
|---|