Mercurial > projects > dwt-win
comparison dwt/dwthelper/utils.d @ 332:1ee938a6e02e
Tango updates, removing trace prints and added prints via Logger
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 01 Feb 2009 19:40:09 +0100 |
parents | 0c891bed575f |
children | f866e80af235 |
comparison
equal
deleted
inserted
replaced
331:27479f54069d | 332:1ee938a6e02e |
---|---|
19 import tango.text.convert.Utf; | 19 import tango.text.convert.Utf; |
20 import tango.core.Exception; | 20 import tango.core.Exception; |
21 import tango.stdc.stdlib : exit; | 21 import tango.stdc.stdlib : exit; |
22 | 22 |
23 import tango.util.log.Trace; | 23 import tango.util.log.Trace; |
24 import tango.util.log.Log; | |
24 import tango.text.UnicodeData; | 25 import tango.text.UnicodeData; |
26 | |
27 Logger getDwtLogger(){ | |
28 return Log.lookup( "dwt" ); | |
29 } | |
25 | 30 |
26 alias char[] String; | 31 alias char[] String; |
27 alias tango.text.Text.Text!(char) StringBuffer; | 32 alias tango.text.Text.Text!(char) StringBuffer; |
28 | 33 |
29 alias ArrayBoundsException ArrayIndexOutOfBoundsException; | 34 alias ArrayBoundsException ArrayIndexOutOfBoundsException; |
50 } | 55 } |
51 return false; | 56 return false; |
52 } | 57 } |
53 public override hash_t toHash(){ | 58 public override hash_t toHash(){ |
54 return (typeid(T[])).getHash(&array); | 59 return (typeid(T[])).getHash(&array); |
60 } | |
61 static if( is( T == char )){ | |
62 public override char[] toString(){ | |
63 return array; | |
64 } | |
55 } | 65 } |
56 } | 66 } |
57 | 67 |
58 class ValueWrapperT(T) : ValueWrapper { | 68 class ValueWrapperT(T) : ValueWrapper { |
59 public T value; | 69 public T value; |
474 dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate ); | 484 dchar[] res = tango.text.convert.Utf.toString32( str, buf, &ate ); |
475 assert( ate is str.length ); | 485 assert( ate is str.length ); |
476 return res.length; | 486 return res.length; |
477 } | 487 } |
478 | 488 |
479 alias tango.text.convert.Utf.toString16 toString16; | 489 //alias tango.text.convert.Utf.toString16 toString16; |
480 alias tango.text.convert.Utf.toString toString; | 490 //alias tango.text.convert.Utf.toString toString; |
481 | 491 |
482 int toAbsoluteCodePointStartOffset( String str, int index ){ | 492 int toAbsoluteCodePointStartOffset( String str, int index ){ |
483 //Trace.formatln( "str={}, str.length={}, index={}", str, str.length, index ); | 493 //Trace.formatln( "str={}, str.length={}, index={}", str, str.length, index ); |
484 //Trace.memory( str ); | 494 //Trace.memory( str ); |
485 if( ( str[index] & 0x80 ) is 0x00 ) | 495 if( ( str[index] & 0x80 ) is 0x00 ) |
1065 } | 1075 } |
1066 | 1076 |
1067 void ExceptionPrintStackTrace( Exception e ){ | 1077 void ExceptionPrintStackTrace( Exception e ){ |
1068 ExceptionPrintStackTrace( e, Stderr ); | 1078 ExceptionPrintStackTrace( e, Stderr ); |
1069 } | 1079 } |
1070 void ExceptionPrintStackTrace( Exception e, Print!(char) print ){ | 1080 void ExceptionPrintStackTrace( Exception e, FormatOutput!(char) print ){ |
1071 Exception exception = e; | 1081 Exception exception = e; |
1072 while( exception !is null ){ | 1082 while( exception !is null ){ |
1073 print.formatln( "Exception in {}({}): {}", exception.file, exception.line, exception.msg ); | 1083 print.formatln( "Exception in {}({}): {}", exception.file, exception.line, exception.msg ); |
1074 if( exception.info !is null ){ | 1084 if( exception.info !is null ){ |
1075 foreach( msg; exception.info ){ | 1085 foreach( msg; exception.info ){ |