diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/vhdl/errorout.adb | 22 | 
1 files changed, 19 insertions, 3 deletions
diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb index f65cb555f..6b2c36e3b 100644 --- a/src/vhdl/errorout.adb +++ b/src/vhdl/errorout.adb @@ -15,7 +15,9 @@  --  along with GHDL; see the file COPYING.  If not, write to the Free  --  Software Foundation, 59 Temple Place - Suite 330, Boston, MA  --  02111-1307, USA. +  with Ada.Text_IO; +with GNAT.OS_Lib;  with Scanner;  with Name_Table;  with Iirs_Utils; use Iirs_Utils; @@ -34,14 +36,28 @@ package body Errorout is     --  Set Flag_Color_Diagnostics to On or Off if is was Auto.     procedure Detect_Terminal     is +      --  Import isatty.        function isatty (Fd : Integer) return Integer;        pragma Import (C, isatty); + +      --  Awful way to detect if the host is Windows.  Should be replaced by +      --  a host-specific package. +      Is_Windows : constant Boolean := GNAT.OS_Lib.Directory_Separator = '\';     begin        if Flag_Color_Diagnostics = Auto then -         if isatty (2) /= 0 then -            Flag_Color_Diagnostics := On; -         else +         if Is_Windows then +            --  Off by default on Windows, as the consoles may not support +            --  ANSI control sequences.  Should be replaced by calls to the +            --  Win32 API.              Flag_Color_Diagnostics := Off; +         else +            --  On Linux/Unix/Mac OS X: use color only when the output is to a +            --  tty. +            if isatty (2) /= 0 then +               Flag_Color_Diagnostics := On; +            else +               Flag_Color_Diagnostics := Off; +            end if;           end if;        end if;     end Detect_Terminal;  | 
