comparison dwt/dwthelper/utils.d @ 123:63a09873578e

Fixed compile errors
author Jacob Carlborg <doob@me.com>
date Thu, 15 Jan 2009 23:08:54 +0100
parents 2e671fa40eec
children 38807a925e24
comparison
equal deleted inserted replaced
122:2e671fa40eec 123:63a09873578e
1 /** 1 /**
2 * Authors: Frank Benoit <keinfarbton@googlemail.com> 2 * Authors: Frank Benoit <keinfarbton@googlemail.com>
3 * Jacob Carlborg <doob@me.com>
4 */ 3 */
5 module dwt.dwthelper.utils; 4 module dwt.dwthelper.utils;
6 5
7 public import dwt.dwthelper.System; 6 public import dwt.dwthelper.System;
8 public import Math = tango.math.Math; 7 public import Math = tango.math.Math;
31 import tango.stdc.stdlib : exit; 30 import tango.stdc.stdlib : exit;
32 31
33 import tango.util.log.Trace; 32 import tango.util.log.Trace;
34 import tango.text.UnicodeData; 33 import tango.text.UnicodeData;
35 static import tango.util.collection.model.Seq; 34 static import tango.util.collection.model.Seq;
36
37 static import dwt.dwthelper.array;
38 35
39 alias bool boolean; 36 alias bool boolean;
40 alias char[] String; 37 alias char[] String;
41 alias tango.text.Text.Text!(char) StringBuffer; 38 alias tango.text.Text.Text!(char) StringBuffer;
42 39
270 267
271 public static float POSITIVE_INFINITY = (1.0f / 0.0f); 268 public static float POSITIVE_INFINITY = (1.0f / 0.0f);
272 public static float NEGATIVE_INFINITY = ((-1.0f) / 0.0f); 269 public static float NEGATIVE_INFINITY = ((-1.0f) / 0.0f);
273 public static float NaN = (0.0f / 0.0f); 270 public static float NaN = (0.0f / 0.0f);
274 public static float MAX_VALUE = 3.4028235e+38f; 271 public static float MAX_VALUE = 3.4028235e+38f;
275 public static float MIN_VALUE = 1.4e-45f; 272 public static float MIN_VALUE = float.min;
273 //public static float MIN_VALUE = 1.4e-45f;
276 public static int SIZE = 32; 274 public static int SIZE = 32;
277 275
278 this( float value ){ 276 this( float value ){
279 super(value); 277 super(value);
280 } 278 }
533 { 531 {
534 static alias CharacterIsLetter isLetter; 532 static alias CharacterIsLetter isLetter;
535 static alias CharacterIsLetterOrDigit isLetterOrDigit; 533 static alias CharacterIsLetterOrDigit isLetterOrDigit;
536 static alias CharacterIsSpaceChar isSpaceChar; 534 static alias CharacterIsSpaceChar isSpaceChar;
537 static alias CharacterIsWhitespace isWhitespace; 535 static alias CharacterIsWhitespace isWhitespace;
538 static alias CharacterIsDigit isDigit;
539 536
540 static T toLowerCase (T)(T c) 537 static char toLowerCase (char c)
541 { 538 {
542 return tango.text.Unicode.toLower([c])[0]; 539 return tango.text.Unicode.toLower([c])[0];
543 } 540 }
541
542 static bool isDigit (dchar c)
543 {
544 return tango.text.Unicode.isDigit(c);
545 }
546 }
547
548 struct String_
549 {
550 static String valueOf (int i)
551 {
552 return tango.text.convert.Integer.toString(i);
553 }
544 } 554 }
545 555
546 String new_String( String cont, int offset, int len ){ 556 String new_String( String cont, int offset, int len ){
547 return cont[ offset .. offset+len ].dup; 557 return cont[ offset .. offset+len ].dup;
548 } 558 }
549 559
550 String new_String(String cont){ 560 String new_String (String cont){
551 return cont.dup; 561 return cont.dup;
552 }
553
554 String new_String(wchar[] cont){
555 return cont.toString16();
556 } 562 }
557 563
558 public String toUpperCase( String str ){ 564 public String toUpperCase( String str ){
559 return tango.text.Unicode.toUpper( str ); 565 return tango.text.Unicode.toUpper( str );
560 } 566 }
704 radix is 8 ? "o" : 710 radix is 8 ? "o" :
705 radix is 16 ? "x" : 711 radix is 16 ? "x" :
706 "d" ); 712 "d" );
707 } 713 }
708 714
709 public alias tango.stdc.stringz.toStringz toStringz;
710 public alias tango.stdc.stringz.toString16z toString16z;
711 public alias tango.stdc.stringz.fromStringz fromStringz;
712 public alias tango.stdc.stringz.fromString16z fromString16z;
713
714 struct String_
715 {
716 static String valueOf (int v)
717 {
718 return tango.text.convert.Integer.toString(v, 10);
719 }
720 }
721
722 class RuntimeException : Exception { 715 class RuntimeException : Exception {
723 this( String e = null){ 716 this( String e = null){
724 super(e); 717 super(e);
725 } 718 }
726 this( Exception e ){ 719 this( Exception e ){