OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #library("builtin"); | |
6 #import("dart:nativewrappers"); | |
7 #import("dart:coreimpl"); | |
8 | |
9 void print(arg) { | |
10 _Logger._printString(arg.toString()); | |
11 } | |
12 | |
13 void exit(int status) { | |
14 if (status is !int) { | |
15 throw new IllegalArgumentException("int status expected"); | |
16 } | |
17 _exit(status); | |
18 } | |
19 | |
20 Socket _stdin; | 5 Socket _stdin; |
21 InputStream get stdin() { | 6 InputStream get stdin() { |
22 if (_stdin == null) { | 7 if (_stdin == null) { |
23 _stdin = new _Socket._internalReadOnly(); | 8 _stdin = new _Socket._internalReadOnly(); |
24 _getStdioHandle(_stdin, 0); | 9 _getStdioHandle(_stdin, 0); |
25 } | 10 } |
26 return _stdin.inputStream; | 11 return _stdin.inputStream; |
27 } | 12 } |
28 | 13 |
29 Socket _stdout; | 14 Socket _stdout; |
30 OutputStream get stdout() { | 15 OutputStream get stdout() { |
31 if (_stdout == null) { | 16 if (_stdout == null) { |
32 _stdout = new _Socket._internalWriteOnly(); | 17 _stdout = new _Socket._internalWriteOnly(); |
33 _getStdioHandle(_stdout, 1); | 18 _getStdioHandle(_stdout, 1); |
34 } | 19 } |
35 return _stdout.outputStream; | 20 return _stdout.outputStream; |
36 } | 21 } |
37 | 22 |
38 Socket _stderr; | 23 Socket _stderr; |
39 OutputStream get stderr() { | 24 OutputStream get stderr() { |
40 if (_stderr == null) { | 25 if (_stderr == null) { |
41 _stderr = new _Socket._internalWriteOnly(); | 26 _stderr = new _Socket._internalWriteOnly(); |
42 _getStdioHandle(_stderr, 2); | 27 _getStdioHandle(_stderr, 2); |
43 } | 28 } |
44 return _stderr.outputStream; | 29 return _stderr.outputStream; |
45 } | 30 } |
46 | 31 |
47 _exit(int status) native "Exit"; | |
48 | |
49 _getStdioHandle(Socket socket, int num) native "Socket_GetStdioHandle"; | 32 _getStdioHandle(Socket socket, int num) native "Socket_GetStdioHandle"; |
50 | |
51 class _Logger { | |
52 static void _printString(String s) native "Logger_PrintString"; | |
53 } | |
OLD | NEW |