diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/grt/grt-errors.adb | 20 | ||||
| -rw-r--r-- | src/grt/grt-errors.ads | 5 | ||||
| -rw-r--r-- | src/grt/grt-main.adb | 4 | 
3 files changed, 23 insertions, 6 deletions
| diff --git a/src/grt/grt-errors.adb b/src/grt/grt-errors.adb index 9a48de48e..28ee85963 100644 --- a/src/grt/grt-errors.adb +++ b/src/grt/grt-errors.adb @@ -29,6 +29,14 @@ with Grt.Hooks; use Grt.Hooks;  with Grt.Backtraces;  package body Grt.Errors is +   --  Output stream to send error messages +   Out_Stream : FILEs; + +   procedure Set_Out_Stream (Stream : Grt.Stdio.FILEs) is +   begin +      Out_Stream := Stream; +   end Set_Out_Stream; +     --  Called in case of premature exit.     --  CODE is 0 for success, 1 for failure.     procedure Ghdl_Exit (Code : Integer); @@ -74,27 +82,27 @@ package body Grt.Errors is     procedure Put_Err (Str : String) is     begin -      Put (stderr, Str); +      Put (Out_Stream, Str);     end Put_Err;     procedure Put_Err (C : Character) is     begin -      Put (stderr, C); +      Put (Out_Stream, C);     end Put_Err;     procedure Put_Err (Str : Ghdl_C_String) is     begin -      Put (stderr, Str); +      Put (Out_Stream, Str);     end Put_Err;     procedure Put_Err (N : Integer) is     begin -      Put_I32 (stderr, Ghdl_I32 (N)); +      Put_I32 (Out_Stream, Ghdl_I32 (N));     end Put_Err;     procedure Newline_Err is     begin -      New_Line (stderr); +      New_Line (Out_Stream);     end Newline_Err;  --    procedure Put_Err (Str : Ghdl_Str_Len_Type) @@ -133,7 +141,7 @@ package body Grt.Errors is     procedure Report_Now_C is     begin -      Put_Time (stderr, Grt.Types.Current_Time); +      Put_Time (Out_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 974ef3820..b7ee4c24d 100644 --- a/src/grt/grt-errors.ads +++ b/src/grt/grt-errors.ads @@ -24,10 +24,15 @@  --  covered by the GNU Public License.  with Grt.Types; use Grt.Types;  with Grt.Hooks; +with Grt.Stdio;  package Grt.Errors is     pragma Preelaborate (Grt.Errors); +   --  Set the stream for error messages.  Must be called before using this +   --  package. +   procedure Set_Out_Stream (Stream : Grt.Stdio.FILEs); +     --  Multi-call error procedure.     --  Start and continue with Error_C, finish by an Error_E.     procedure Error_C (Str : String); diff --git a/src/grt/grt-main.adb b/src/grt/grt-main.adb index 4c37e1da7..7bc2bd57f 100644 --- a/src/grt/grt-main.adb +++ b/src/grt/grt-main.adb @@ -25,6 +25,7 @@  with System.Storage_Elements; --  Work around GNAT bug.  pragma Unreferenced (System.Storage_Elements);  with Grt.Types; use Grt.Types; +with Grt.Stdio;  with Grt.Errors;  with Grt.Processes;  with Grt.Signals; @@ -110,6 +111,9 @@ package body Grt.Main is        Stop : Boolean;        Status : Integer;     begin +      --  Set stream for error messages +      Grt.Errors.Set_Out_Stream (Grt.Stdio.stdout); +        --  Register modules.        --  They may insert hooks.        Grt.Modules.Register_Modules; | 
