comparison dwt/dwthelper/utils.d @ 126:38807a925e24

Fixed compile errors, support for SWT language files
author Jacob Carlborg <doob@me.com>
date Fri, 16 Jan 2009 23:35:40 +0100
parents 63a09873578e
children 07399639c0c8
comparison
equal deleted inserted replaced
125:5583f8eeee6c 126:38807a925e24
2 * Authors: Frank Benoit <keinfarbton@googlemail.com> 2 * Authors: Frank Benoit <keinfarbton@googlemail.com>
3 */ 3 */
4 module dwt.dwthelper.utils; 4 module dwt.dwthelper.utils;
5 5
6 public import dwt.dwthelper.System; 6 public import dwt.dwthelper.System;
7 public import dwt.dwthelper.Runnable;
7 public import Math = tango.math.Math; 8 public import Math = tango.math.Math;
8 9
9 public import tango.core.Exception : IllegalArgumentException, IOException, PlatformException; 10 public import tango.core.Exception : IllegalArgumentException, IOException, PlatformException;
10 11
11 import tango.io.Stdout; 12 import tango.io.Stdout;
39 40
40 alias PlatformException Error; 41 alias PlatformException Error;
41 alias Exception Throwable; 42 alias Exception Throwable;
42 43
43 alias ClassInfo Class; 44 alias ClassInfo Class;
45
46 public import dwt.dwthelper.array;
44 47
45 void implMissing( String file, uint line ){ 48 void implMissing( String file, uint line ){
46 Stderr.formatln( "implementation missing in file {} line {}", file, line ); 49 Stderr.formatln( "implementation missing in file {} line {}", file, line );
47 Stderr.formatln( "exiting ..." ); 50 Stderr.formatln( "exiting ..." );
48 exit(1); 51 exit(1);
267 270
268 public static float POSITIVE_INFINITY = (1.0f / 0.0f); 271 public static float POSITIVE_INFINITY = (1.0f / 0.0f);
269 public static float NEGATIVE_INFINITY = ((-1.0f) / 0.0f); 272 public static float NEGATIVE_INFINITY = ((-1.0f) / 0.0f);
270 public static float NaN = (0.0f / 0.0f); 273 public static float NaN = (0.0f / 0.0f);
271 public static float MAX_VALUE = 3.4028235e+38f; 274 public static float MAX_VALUE = 3.4028235e+38f;
272 public static float MIN_VALUE = float.min; 275 public static float MIN_VALUE = 1.4e-45f;
273 //public static float MIN_VALUE = 1.4e-45f;
274 public static int SIZE = 32; 276 public static int SIZE = 32;
275 277
276 this( float value ){ 278 this( float value ){
277 super(value); 279 super(value);
278 } 280 }
563 565
564 public String toUpperCase( String str ){ 566 public String toUpperCase( String str ){
565 return tango.text.Unicode.toUpper( str ); 567 return tango.text.Unicode.toUpper( str );
566 } 568 }
567 569
568 public int indexOf( String str, char searched ){ 570 /*public int indexOf( String str, char searched ){
569 int res = tango.text.Util.locate( str, searched ); 571 int res = tango.text.Util.locate( str, searched );
570 if( res is str.length ) res = -1; 572 if( res is str.length ) res = -1;
571 return res; 573 return res;
572 } 574 }
573 575
574 public int indexOf( String str, char searched, int startpos ){ 576 public int indexOf( String str, char searched, int startpos ){
575 int res = tango.text.Util.locate( str, searched, startpos ); 577 int res = tango.text.Util.locate( str, searched, startpos );
576 if( res is str.length ) res = -1; 578 if( res is str.length ) res = -1;
577 return res; 579 return res;
578 } 580 }*/
579 581
580 public int indexOf(String str, String ch){ 582 /*public int indexOf(String str, String ch){
581 return indexOf( str, ch, 0 ); 583 return indexOf( str, ch, 0 );
582 } 584 }
583 585
584 public int indexOf(String str, String ch, int start){ 586 public int indexOf(String str, String ch, int start){
585 int res = tango.text.Util.locatePattern( str, ch, start ); 587 int res = tango.text.Util.locatePattern( str, ch, start );
586 if( res is str.length ) res = -1; 588 if( res is str.length ) res = -1;
587 return res; 589 return res;
588 } 590 }*/
589 591
590 public int lastIndexOf(String str, char ch){ 592 public int lastIndexOf(String str, char ch){
591 return lastIndexOf( str, ch, str.length ); 593 return lastIndexOf( str, ch, str.length );
592 } 594 }
593 public int lastIndexOf(String str, char ch, int formIndex){ 595 public int lastIndexOf(String str, char ch, int formIndex){
696 static const String nullPtr = "\0"; 698 static const String nullPtr = "\0";
697 return nullPtr.ptr; 699 return nullPtr.ptr;
698 } 700 }
699 } 701 }
700 702
701 public String fromStringz (char* str) 703 public alias tango.stdc.stringz.toStringz toStringz;
702 { 704 public alias tango.stdc.stringz.toString16z toString16z;
703 return tango.stdc.stringz.fromStringz(str); 705 public alias tango.stdc.stringz.fromStringz fromStringz;
704 } 706 public alias tango.stdc.stringz.fromString16z fromString16z;
705 707
706 static String toHex(uint value, bool prefix = true, int radix = 8){ 708 static String toHex(uint value, bool prefix = true, int radix = 8){
707 return tango.text.convert.Integer.toString( 709 return tango.text.convert.Integer.toString(
708 value, 710 value,
709 radix is 10 ? "d" : 711 radix is 10 ? "d" :