diff options
author | Brian Drummond <brian@shapes.demon.co.uk> | 2017-10-04 19:05:36 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-10-05 06:15:25 +0200 |
commit | ffd9fe10d40a133786358828cfab361377b9e8de (patch) | |
tree | 7e74087448bc579f922a3b6dfc995c0fc807c8d4 /src/grt | |
parent | 6a465e007f8cd5be01137e2981c5a4864b46cd5b (diff) | |
download | ghdl-ffd9fe10d40a133786358828cfab361377b9e8de.tar.gz ghdl-ffd9fe10d40a133786358828cfab361377b9e8de.tar.bz2 ghdl-ffd9fe10d40a133786358828cfab361377b9e8de.zip |
Make error stream available for additional reporting : see issue #26
Diffstat (limited to 'src/grt')
-rw-r--r-- | src/grt/grt-errors.adb | 25 | ||||
-rw-r--r-- | src/grt/grt-errors.ads | 3 | ||||
-rw-r--r-- | src/grt/grt-main.adb | 2 |
3 files changed, 18 insertions, 12 deletions
diff --git a/src/grt/grt-errors.adb b/src/grt/grt-errors.adb index 28ee85963..e9e2f54ad 100644 --- a/src/grt/grt-errors.adb +++ b/src/grt/grt-errors.adb @@ -30,12 +30,17 @@ with Grt.Backtraces; package body Grt.Errors is -- Output stream to send error messages - Out_Stream : FILEs; + Error_Stream : FILEs; - procedure Set_Out_Stream (Stream : Grt.Stdio.FILEs) is + procedure Set_Error_Stream (Stream : Grt.Stdio.FILEs) is begin - Out_Stream := Stream; - end Set_Out_Stream; + Error_Stream := Stream; + end Set_Error_Stream; + + function Get_Error_Stream return Grt.Stdio.FILEs is + begin + return Error_Stream; + end Get_Error_Stream; -- Called in case of premature exit. -- CODE is 0 for success, 1 for failure. @@ -82,27 +87,27 @@ package body Grt.Errors is procedure Put_Err (Str : String) is begin - Put (Out_Stream, Str); + Put (Error_Stream, Str); end Put_Err; procedure Put_Err (C : Character) is begin - Put (Out_Stream, C); + Put (Error_Stream, C); end Put_Err; procedure Put_Err (Str : Ghdl_C_String) is begin - Put (Out_Stream, Str); + Put (Error_Stream, Str); end Put_Err; procedure Put_Err (N : Integer) is begin - Put_I32 (Out_Stream, Ghdl_I32 (N)); + Put_I32 (Error_Stream, Ghdl_I32 (N)); end Put_Err; procedure Newline_Err is begin - New_Line (Out_Stream); + New_Line (Error_Stream); end Newline_Err; -- procedure Put_Err (Str : Ghdl_Str_Len_Type) @@ -141,7 +146,7 @@ package body Grt.Errors is procedure Report_Now_C is begin - Put_Time (Out_Stream, Grt.Types.Current_Time); + Put_Time (Error_Stream, Grt.Types.Current_Time); end Report_Now_C; procedure Report_E (Str : String) is diff --git a/src/grt/grt-errors.ads b/src/grt/grt-errors.ads index b7ee4c24d..5d316aaea 100644 --- a/src/grt/grt-errors.ads +++ b/src/grt/grt-errors.ads @@ -31,7 +31,8 @@ package Grt.Errors is -- Set the stream for error messages. Must be called before using this -- package. - procedure Set_Out_Stream (Stream : Grt.Stdio.FILEs); + procedure Set_Error_Stream (Stream : Grt.Stdio.FILEs); + function Get_Error_Stream return Grt.Stdio.FILEs; -- Multi-call error procedure. -- Start and continue with Error_C, finish by an Error_E. diff --git a/src/grt/grt-main.adb b/src/grt/grt-main.adb index 7bc2bd57f..6fae4c871 100644 --- a/src/grt/grt-main.adb +++ b/src/grt/grt-main.adb @@ -112,7 +112,7 @@ package body Grt.Main is Status : Integer; begin -- Set stream for error messages - Grt.Errors.Set_Out_Stream (Grt.Stdio.stdout); + Grt.Errors.Set_Error_Stream (Grt.Stdio.stdout); -- Register modules. -- They may insert hooks. |