Lines Matching full:console
1142 /***** Console Window Terminal Emulation *****/
1147 // This reads input from a Win32 console window and translates it into Unix
1157 // console windows on Windows, but to be better than the original code which
1162 // This implementation reconfigures the console with SetConsoleMode(), then
1169 // * _get_console_handle() and unix_isatty() provide console information.
1170 // * stdin_raw_init() and stdin_raw_restore() reconfigure the console.
1171 // * unix_read() detects console windows (as opposed to pipes, files, etc.).
1174 // Returns a console HANDLE if |fd| is a console, otherwise returns nullptr.
1176 // with the console mode. Requires GENERIC_READ access to the underlying HANDLE.
1178 // First check isatty(); this is very fast and eliminates most non-console
1203 // Returns a console handle if |stream| is a console, otherwise returns nullptr.
1219 static bool _get_key_event_record(const HANDLE console, INPUT_RECORD* const input_record) {
1223 if (!ReadConsoleInputA(console, input_record, 1, &read_count)) {
1238 // If the console window is resized, emulate SIGWINCH by breaking out
1240 // vertical resize because we don't give the console our own custom
1611 // returns zero on console closure because Win32 consoles are never 'closed' (as far as I can tell).
1612 static int _console_read(const HANDLE console, void* buf, size_t len) {
1614 // Read of zero bytes should not block waiting for something from the console.
1628 // Read from the actual console. This may block until input.
1630 if (!_get_key_event_record(console, &input_record)) {
1974 static HANDLE _console_handle; // when set, console mode should be restored
2001 // reading from and that the old console mode should be restored later.
2006 // read from the console.
2026 // called, and it successfully configured the console, then read from
2027 // the console using Win32 console APIs and partially emulate a unix
2032 // ReadConsole() with a size >= 31367 fails, so if |fd| is a console
2057 // outputting Unicode text to a Win32 console window. This is inspired from
2102 // Unicode console output
2105 // The way to output Unicode to a Win32 console window is to call
2107 // such as Lucida Console or Consolas, and in the case of East Asian languages
2110 // font to be used in console windows.)
2328 // Bytes that have not yet been output to the console because they are incomplete UTF-8 sequences.
2332 // Internal helper function to write UTF-8 bytes to a console. Returns -1 on error.
2334 HANDLE console) {
2341 // Complete UTF-8 sequences that should be immediately written to the console.
2374 // doesn't seem necessary for the Windows console. For the Windows
2375 // console \r moves to the beginning of the line and \n moves to a new
2382 // Write UTF-16 to the console.
2384 if (!WriteConsoleW(console, utf16.c_str(), utf16.length(), &written, NULL)) {
2397 static int _console_vfprintf(const HANDLE console, FILE* stream,
2401 // Internal function to format a UTF-8 string and write it to a Win32 console.
2403 static int _console_vfprintf(const HANDLE console, FILE* stream,
2413 console);
2423 // Windows console.
2425 const HANDLE console = _get_console_handle(stream);
2427 // If there is an associated Win32 console, write to it specially,
2429 if (console != NULL) {
2430 return _console_vfprintf(console, stream, format, ap);
2441 // Version of vprintf() that takes UTF-8 and can write Unicode to a Windows console.
2447 // Windows console.
2458 // Windows console.
2469 // Windows console.
2478 // Windows console.
2488 // Version of putchar() that takes UTF-8 and can write Unicode to a Windows console.
2493 // Version of puts() that takes UTF-8 and can write Unicode to a Windows console.
2501 // Internal function to write UTF-8 to a Win32 console. Returns the number of
2504 FILE* stream, HANDLE console) {
2506 console);
2514 // Windows console.
2516 const HANDLE console = _get_console_handle(stream);
2518 // If there is an associated Win32 console, write to it specially,
2520 if (console != NULL) {
2521 return _console_fwrite(ptr, size, nmemb, stream, console);