diff options
Diffstat (limited to 'src/grt/grt-files.adb')
-rw-r--r-- | src/grt/grt-files.adb | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/grt/grt-files.adb b/src/grt/grt-files.adb index 46d3ced..1f037a7 100644 --- a/src/grt/grt-files.adb +++ b/src/grt/grt-files.adb @@ -384,27 +384,25 @@ package body Grt.Files is end Ghdl_Text_Read_Length; procedure Ghdl_Untruncated_Text_Read - (Params : Ghdl_Untruncated_Text_Read_Params_Acc) + (File : Ghdl_File_Index; Str : Std_String_Ptr; Len : Std_Integer_Acc) is - Str : constant Std_String_Ptr := Params.Str; Stream : C_Files; - Len : int; - Idx : Ghdl_Index_Type; + Max_Len : int; begin - Stream := Get_File (Params.File); - Check_File_Mode (Params.File, True); - Len := int (Str.Bounds.Dim_1.Length); - if fgets (Str.Base (0)'Address, Len, Stream) = Null_Address then + Stream := Get_File (File); + Check_File_Mode (File, True); + Max_Len := int (Str.Bounds.Dim_1.Length); + if fgets (Str.Base (0)'Address, Max_Len, Stream) = Null_Address then Internal_Error ("ghdl_untruncated_text_read: end of file"); end if; + -- Compute the length. for I in Ghdl_Index_Type loop if Str.Base (I) = NUL then - Idx := I; + Len.all := Std_Integer (I); exit; end if; end loop; - Params.Len := Std_Integer (Idx); end Ghdl_Untruncated_Text_Read; procedure File_Close (File : Ghdl_File_Index; Is_Text : Boolean) |