OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 @patch | 5 @patch |
6 class _StdIOUtils { | 6 class _StdIOUtils { |
7 @patch | 7 @patch |
8 static Stdin _getStdioInputStream() { | 8 static Stdin _getStdioInputStream() { |
9 switch (_getStdioHandleType(0)) { | 9 switch (_getStdioHandleType(0)) { |
10 case _STDIO_HANDLE_TYPE_TERMINAL: | 10 case _STDIO_HANDLE_TYPE_TERMINAL: |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 @patch | 92 @patch |
93 void set lineMode(bool enabled) { | 93 void set lineMode(bool enabled) { |
94 var result = _setLineMode(enabled); | 94 var result = _setLineMode(enabled); |
95 if (result is OSError) { | 95 if (result is OSError) { |
96 throw new StdinException("Error setting terminal line mode", result); | 96 throw new StdinException("Error setting terminal line mode", result); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 @patch bool get supportsAnsiEscapes { | 100 @patch |
| 101 bool get supportsAnsiEscapes { |
101 var result = _supportsAnsiEscapes(); | 102 var result = _supportsAnsiEscapes(); |
102 if (result is OSError) { | 103 if (result is OSError) { |
103 throw new StdinException("Error determining ANSI support", result); | 104 throw new StdinException("Error determining ANSI support", result); |
104 } | 105 } |
105 return result; | 106 return result; |
106 } | 107 } |
107 | 108 |
108 static _echoMode() native "Stdin_GetEchoMode"; | 109 static _echoMode() native "Stdin_GetEchoMode"; |
109 static _setEchoMode(bool enabled) native "Stdin_SetEchoMode"; | 110 static _setEchoMode(bool enabled) native "Stdin_SetEchoMode"; |
110 static _lineMode() native "Stdin_GetLineMode"; | 111 static _lineMode() native "Stdin_GetLineMode"; |
(...skipping 22 matching lines...) Expand all Loading... |
133 static List _terminalSize(int fd) { | 134 static List _terminalSize(int fd) { |
134 var size = _getTerminalSize(fd); | 135 var size = _getTerminalSize(fd); |
135 if (size is! List) { | 136 if (size is! List) { |
136 throw new StdoutException("Could not get terminal size", size); | 137 throw new StdoutException("Could not get terminal size", size); |
137 } | 138 } |
138 return size; | 139 return size; |
139 } | 140 } |
140 | 141 |
141 static _getTerminalSize(int fd) native "Stdout_GetTerminalSize"; | 142 static _getTerminalSize(int fd) native "Stdout_GetTerminalSize"; |
142 | 143 |
143 @patch static bool _supportsAnsiEscapes(int fd) { | 144 @patch |
| 145 static bool _supportsAnsiEscapes(int fd) { |
144 var result = _getAnsiSupported(fd); | 146 var result = _getAnsiSupported(fd); |
145 if (result is! bool) { | 147 if (result is! bool) { |
146 throw new StdoutException("Error determining ANSI support", result); | 148 throw new StdoutException("Error determining ANSI support", result); |
147 } | 149 } |
148 return result; | 150 return result; |
149 } | 151 } |
150 | 152 |
151 static _getAnsiSupported(int fd) native "Stdout_AnsiSupported"; | 153 static _getAnsiSupported(int fd) native "Stdout_AnsiSupported"; |
152 } | 154 } |
153 | 155 |
154 _getStdioHandle(_NativeSocket socket, int num) native "Socket_GetStdioHandle"; | 156 _getStdioHandle(_NativeSocket socket, int num) native "Socket_GetStdioHandle"; |
155 _getSocketType(_NativeSocket nativeSocket) native "Socket_GetType"; | 157 _getSocketType(_NativeSocket nativeSocket) native "Socket_GetType"; |
OLD | NEW |