summaryrefslogtreecommitdiff
path: root/libraries/base/include/consUtils.h
Commit message (Collapse)AuthorAgeFilesLines
* winio: Multiple refactorings and support changes.Tamar Christina2020-07-151-2/+1
|
* cpp: Use #pragma once instead of #ifndef guardsBen Gamari2017-04-231-3/+2
| | | | | | | | | | | | | | This both says what we mean and silences a bunch of spurious CPP linting warnings. This pragma is supported by all CPP implementations which we support. Reviewers: austin, erikd, simonmar, hvr Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3482
* More accurate isatty test for MinGW.Edward Z. Yang2010-09-071-0/+1
|
* [project @ 2005-05-06 00:30:56 by sof]sof2005-05-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [mingw only] Work around bug in win32 Console API which showed up in the GHCi UI: if the user typed in characters prior to the appearance of the prompt, the first of these characters always came out as a 'g'. The GHCi UI does for good reasons one-character reads from 'stdin', which causes the underlying APIs to become confused. A simple repro case is the following piece of C code: /*----------------------*/ #include <stdio.h> #include <windows.h> int main() { char ch1,ch2; HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE); DWORD dw; /* Type in some characters before the prompt appears and be amused.. */ sleep(1000); printf("? "); ReadConsoleA(hStdIn,&ch1,1,&dw,NULL); ReadConsoleA(hStdIn,&ch2,1,&dw,NULL); /* or, if you want to use libc: read(0,&ch1,1); read(0,&ch2,1); */ printf("%c%c\n", ch1,ch2); return 0; } /*----------------------*/ This happens across win32 OSes, and I can't see anything untoward as far as API usage goes (the GHC IO implementation uses read(), but that reduces to ReadConsoleA() calls.) People inside the Behemoth might want to have a closer look at this.. Not much we can do about this except work around the problem by flushing the input buffer prior to reading from stdin. Not ideal, as type-ahead is a useful feature. Flushing is handled by GHC.ConsoleHandler.flushConsole Merge to STABLE.
* [project @ 2002-07-18 22:01:07 by sof]sof2002-07-181-0/+11
helper functions for mucking about with Win32 consoles