| 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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
| 6 | 6 |
| 7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
| 8 #if defined(HOST_OS_WINDOWS) | 8 #if defined(HOST_OS_WINDOWS) |
| 9 | 9 |
| 10 #include "bin/stdio.h" | 10 #include "bin/stdio.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 return SetConsoleMode(h, mode); | 86 return SetConsoleMode(h, mode); |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 bool Stdin::AnsiSupported(bool* supported) { | 90 bool Stdin::AnsiSupported(bool* supported) { |
| 91 ASSERT(supported != NULL); | 91 ASSERT(supported != NULL); |
| 92 HANDLE h = GetStdHandle(STD_INPUT_HANDLE); | 92 HANDLE h = GetStdHandle(STD_INPUT_HANDLE); |
| 93 if (h == INVALID_HANDLE_VALUE) { | 93 if (h == INVALID_HANDLE_VALUE) { |
| 94 *supported = false; | 94 *supported = false; |
| 95 return false; | 95 return true; |
| 96 } | 96 } |
| 97 DWORD mode; | 97 DWORD mode; |
| 98 if (!GetConsoleMode(h, &mode)) { | 98 if (!GetConsoleMode(h, &mode)) { |
| 99 *supported = false; | 99 *supported = false; |
| 100 return false; | 100 return true; |
| 101 } | 101 } |
| 102 *supported = (mode & ENABLE_VIRTUAL_TERMINAL_INPUT) != 0; | 102 *supported = (mode & ENABLE_VIRTUAL_TERMINAL_INPUT) != 0; |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { | 107 bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { |
| 108 HANDLE h; | 108 HANDLE h; |
| 109 if (fd == 1) { | 109 if (fd == 1) { |
| 110 h = GetStdHandle(STD_OUTPUT_HANDLE); | 110 h = GetStdHandle(STD_OUTPUT_HANDLE); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 124 bool Stdout::AnsiSupported(intptr_t fd, bool* supported) { | 124 bool Stdout::AnsiSupported(intptr_t fd, bool* supported) { |
| 125 ASSERT(supported != NULL); | 125 ASSERT(supported != NULL); |
| 126 HANDLE h; | 126 HANDLE h; |
| 127 if (fd == 1) { | 127 if (fd == 1) { |
| 128 h = GetStdHandle(STD_OUTPUT_HANDLE); | 128 h = GetStdHandle(STD_OUTPUT_HANDLE); |
| 129 } else { | 129 } else { |
| 130 h = GetStdHandle(STD_ERROR_HANDLE); | 130 h = GetStdHandle(STD_ERROR_HANDLE); |
| 131 } | 131 } |
| 132 if (h == INVALID_HANDLE_VALUE) { | 132 if (h == INVALID_HANDLE_VALUE) { |
| 133 *supported = false; | 133 *supported = false; |
| 134 return false; | 134 return true; |
| 135 } | 135 } |
| 136 DWORD mode; | 136 DWORD mode; |
| 137 if (!GetConsoleMode(h, &mode)) { | 137 if (!GetConsoleMode(h, &mode)) { |
| 138 *supported = false; | 138 *supported = false; |
| 139 return false; | 139 return true; |
| 140 } | 140 } |
| 141 *supported = (mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) != 0; | 141 *supported = (mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) != 0; |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace bin | 145 } // namespace bin |
| 146 } // namespace dart | 146 } // namespace dart |
| 147 | 147 |
| 148 #endif // defined(HOST_OS_WINDOWS) | 148 #endif // defined(HOST_OS_WINDOWS) |
| 149 | 149 |
| 150 #endif // !defined(DART_IO_DISABLED) | 150 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |