fix Windows mred -h (and other pre-startup writes to stdout)
svn: r15120
This commit is contained in:
parent
5139875199
commit
23712e3a59
|
@ -2222,6 +2222,15 @@ static HANDLE waiting_sema;
|
||||||
|
|
||||||
typedef HWND (WINAPI* gcw_proc)();
|
typedef HWND (WINAPI* gcw_proc)();
|
||||||
|
|
||||||
|
static void init_console_in()
|
||||||
|
{
|
||||||
|
if (!console_in) {
|
||||||
|
console_in = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
|
wxREGGLOB(console_inport);
|
||||||
|
console_inport = scheme_make_fd_input_port((int)console_in, scheme_intern_symbol("stdin"), 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL WINAPI ConsoleHandler(DWORD op)
|
static BOOL WINAPI ConsoleHandler(DWORD op)
|
||||||
{
|
{
|
||||||
if (stdio_kills_prog) {
|
if (stdio_kills_prog) {
|
||||||
|
@ -2278,14 +2287,10 @@ static void MrEdSchemeMessages(char *msg, ...)
|
||||||
console_out = GetStdHandle(STD_OUTPUT_HANDLE);
|
console_out = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
if (!wx_in_terminal) {
|
if (!wx_in_terminal) {
|
||||||
console_in = GetStdHandle(STD_INPUT_HANDLE);
|
|
||||||
has_stdio = 1;
|
has_stdio = 1;
|
||||||
waiting_sema = CreateSemaphore(NULL, 0, 1, NULL);
|
waiting_sema = CreateSemaphore(NULL, 0, 1, NULL);
|
||||||
SetConsoleCtrlHandler(ConsoleHandler, TRUE);
|
SetConsoleCtrlHandler(ConsoleHandler, TRUE);
|
||||||
|
|
||||||
wxREGGLOB(console_inport);
|
|
||||||
console_inport = scheme_make_fd_input_port((int)console_in, scheme_intern_symbol("stdin"), 0, 0);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
HMODULE hm;
|
HMODULE hm;
|
||||||
gcw_proc gcw;
|
gcw_proc gcw;
|
||||||
|
@ -2417,6 +2422,7 @@ static long mrconsole_get_string(Scheme_Input_Port *ip,
|
||||||
MrEdSchemeMessages("");
|
MrEdSchemeMessages("");
|
||||||
|
|
||||||
#if WCONSOLE_STDIO
|
#if WCONSOLE_STDIO
|
||||||
|
init_console_in();
|
||||||
pipe = console_inport;
|
pipe = console_inport;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2435,6 +2441,7 @@ static Scheme_Object *mrconsole_progress_evt(Scheme_Input_Port *ip)
|
||||||
MrEdSchemeMessages("");
|
MrEdSchemeMessages("");
|
||||||
|
|
||||||
#if WCONSOLE_STDIO
|
#if WCONSOLE_STDIO
|
||||||
|
init_console_in();
|
||||||
pipe = console_inport;
|
pipe = console_inport;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2450,6 +2457,7 @@ static int mrconsole_peeked_read(Scheme_Input_Port *ip,
|
||||||
MrEdSchemeMessages("");
|
MrEdSchemeMessages("");
|
||||||
|
|
||||||
#if WCONSOLE_STDIO
|
#if WCONSOLE_STDIO
|
||||||
|
init_console_in();
|
||||||
pipe = console_inport;
|
pipe = console_inport;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2462,6 +2470,7 @@ static int mrconsole_char_ready(Scheme_Input_Port *ip)
|
||||||
MrEdSchemeMessages("");
|
MrEdSchemeMessages("");
|
||||||
|
|
||||||
#if WCONSOLE_STDIO
|
#if WCONSOLE_STDIO
|
||||||
|
init_console_in();
|
||||||
pipe = console_inport;
|
pipe = console_inport;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2472,6 +2481,7 @@ static void mrconsole_close(Scheme_Input_Port *ip)
|
||||||
{
|
{
|
||||||
Scheme_Object *pipe = (Scheme_Object *)ip->port_data;
|
Scheme_Object *pipe = (Scheme_Object *)ip->port_data;
|
||||||
#if WCONSOLE_STDIO
|
#if WCONSOLE_STDIO
|
||||||
|
init_console_in();
|
||||||
pipe = console_inport;
|
pipe = console_inport;
|
||||||
#endif
|
#endif
|
||||||
scheme_close_input_port(pipe);
|
scheme_close_input_port(pipe);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user