comparison druntime/src/compiler/ldc/util/console.d @ 759:d3eb054172f9

Added copy of druntime from DMD 2.020 modified for LDC.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 11 Nov 2008 01:52:37 +0100
parents
children
comparison
equal deleted inserted replaced
758:f04dde6e882c 759:d3eb054172f9
1 /**
2 * The console module contains some simple routines for console output.
3 *
4 * Copyright: Public Domain
5 * License: Public Domain
6 * Authors: Sean Kelly
7 */
8 module rt.util.console;
9
10
11 private
12 {
13 version (Windows)
14 {
15 import sys.windows.windows;
16 }
17 else version( Posix )
18 {
19 import stdc.posix.unistd;
20 }
21 import util.string;
22 }
23
24
25 struct Console
26 {
27 Console opCall( in char[] val )
28 {
29 version( Windows )
30 {
31 uint count = void;
32 WriteFile( GetStdHandle( 0xfffffff5 ), val.ptr, val.length, &count, null );
33 }
34 else version( Posix )
35 {
36 write( 2, val.ptr, val.length );
37 }
38 return *this;
39 }
40
41
42 Console opCall( uint val )
43 {
44 char[10] tmp = void;
45 return opCall( tmp.intToString( val ) );
46 }
47 }
48
49 Console console;