Reuse existing console if present, or else open a new console, when -console is supplied

release
Doug Coleman 2007-11-21 14:47:15 -06:00
parent 3a5f3c69dc
commit 0da81b3018
2 changed files with 11 additions and 0 deletions

View File

@ -91,4 +91,14 @@ void c_to_factor_toplevel(CELL quot)
void open_console(void) void open_console(void)
{ {
if(!console_open)
{
if(!AttachConsole(ATTACH_PARENT_PROCESS))
{
if(AllocConsole())
console_open = true;
}
else
console_open = true;
}
} }

View File

@ -18,4 +18,5 @@ typedef char F_SYMBOL;
void c_to_factor_toplevel(CELL quot); void c_to_factor_toplevel(CELL quot);
long exception_handler(PEXCEPTION_POINTERS pe); long exception_handler(PEXCEPTION_POINTERS pe);
bool console_open;
void open_console(void); void open_console(void);