From 16a5290c91bc14ca3f3a26f24796761f9f08c0f0 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Tue, 8 Jan 2008 20:40:19 +0000 Subject: Disable highlighting on Win32 --- src/ChangeLog | 5 +++++ src/interp/msgdb.boot | 6 ++++-- src/lib/cfuns-c.c | 19 +++++++++++++------ 3 files changed, 22 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f1f66376..b91d904a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-01-08 Gabriel Dos Reis + + * interp/msgdb.boot (brightPrint0): Disable highlightinh on Win32. + * lib/cfuns-c.c (std_stream_is_terminal): Tidy. + 2008-01-08 Gabriel Dos Reis * boot/Makefile.pamphlet (AXIOM_LOCAL_LISP): Use Lisp image with C diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot index bfd8e1ff..ff40c6fd 100644 --- a/src/interp/msgdb.boot +++ b/src/interp/msgdb.boot @@ -654,13 +654,15 @@ brightPrint0 x == x = '"%%" => sayString '"%" x = '"%b" => - NULL IS_-CONSOLE CUROUTSTREAM + -- FIXME: this kludge is GCL-specific. Find way to support + -- highlighting on all supported Lisp. + NULL IS_-CONSOLE CUROUTSTREAM or %hasFeature KEYWORD::WIN32 or stdStreamIsTerminal(1) = 0 => sayString '" " NULL $highlightAllowed => sayString '" " sayString $highlightFontOn k := blankIndicator x => BLANKS k x = '"%d" => - NULL IS_-CONSOLE CUROUTSTREAM + NULL IS_-CONSOLE CUROUTSTREAM or %hasFeature KEYWORD::WIN32 or stdStreamIsTerminal(1) = 0 => sayString '" " NULL $highlightAllowed => sayString '" " sayString $highlightFontOff diff --git a/src/lib/cfuns-c.c b/src/lib/cfuns-c.c index f588beab..47485408 100644 --- a/src/lib/cfuns-c.c +++ b/src/lib/cfuns-c.c @@ -277,18 +277,25 @@ std_stream_is_terminal(int fd) { assert(fd > -1 && fd < 3); #ifdef __WIN32__ - HANDLE handle; + DWORD handle; switch (fd) { case 0: handle = STD_INPUT_HANDLE; break; case 1: handle = STD_OUTPUT_HANDLE; break; case 2: handle = STD_ERROR_HANDLE; break; } - /* VerifyConsoleIoHandle appears to be an undocumented function. - MS documentation suggests `GetFileType', but then the return - value is still insufficient for determining whether the - output stream is attached to a terminal or not. */ - return VerifyConsoleIoHandle(GetStdHandle(handle)); + /* The MS documentation suggests `GetFileType' for determining + the nature of the file handle. The return value, in our case, + is an over approximation of what we are interested int: Are we + dealing with a stream connected to a terminal? The constant + FILE_TYPE_CHAR characterises character files; in particular + a console terminal, or a printer. There is an undocumented + function `VerifyConsoleIoHandle' to deal precisely with the case + we are interested in. However, while availale in Wine, it is + not available in the MinGW headers. Consequently, we cannot + rely on it for the moment. + So, we may still get garbage out of this function on MS platforms. */ + return GetFileType(GetStdHandle(handle)) == FILE_TYPE_CHAR; #else return isatty(fd); #endif -- cgit v1.2.3