diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-11-16 08:05:59 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-11-16 08:05:59 +0100 |
commit | 706fd3a64ca9d55591542d0488b87698e3835c21 (patch) | |
tree | 08673255458c20801c8d77a0149538935203220f /src/grt | |
parent | 2d50cc903f5cf5eb55ebdc082c9ccb7168e75987 (diff) | |
download | ghdl-706fd3a64ca9d55591542d0488b87698e3835c21.tar.gz ghdl-706fd3a64ca9d55591542d0488b87698e3835c21.tar.bz2 ghdl-706fd3a64ca9d55591542d0488b87698e3835c21.zip |
synth: handle untruncated_text_read.
Diffstat (limited to 'src/grt')
-rw-r--r-- | src/grt/grt-files_operations.adb | 19 | ||||
-rw-r--r-- | src/grt/grt-files_operations.ads | 4 |
2 files changed, 9 insertions, 14 deletions
diff --git a/src/grt/grt-files_operations.adb b/src/grt/grt-files_operations.adb index ed15f7fa0..c7770b5f3 100644 --- a/src/grt/grt-files_operations.adb +++ b/src/grt/grt-files_operations.adb @@ -528,14 +528,14 @@ package body Grt.Files_Operations is Status := Op_Ok; end Ghdl_Text_Read_Length; - procedure Ghdl_Untruncated_Text_Read - (File : Ghdl_File_Index; Str : Std_String_Ptr; Len : out Std_Integer; - Status : out Op_Status) + procedure Ghdl_Untruncated_Text_Read (File : Ghdl_File_Index; + Buf : Ghdl_C_String; + Len : in out Std_Integer; + Status : out Op_Status) is Stream : C_Files; Max_Len : int; begin - Len := 0; Get_File (File, Stream, Status); if Status /= Op_Ok then return; @@ -545,19 +545,14 @@ package body Grt.Files_Operations is return; end if; - Max_Len := int (Str.Bounds.Dim_1.Length); - if fgets (Str.Base (0)'Address, Max_Len, Stream) = Null_Address then + Max_Len := int (Len); + if fgets (To_Address (Buf), Max_Len, Stream) = Null_Address then Status := Op_End_Of_File; return; end if; -- Compute the length. - for I in Ghdl_Index_Type loop - if Str.Base (I) = NUL then - Len := Std_Integer (I); - exit; - end if; - end loop; + Len := Std_Integer (strlen (Buf)); Status := Op_Ok; end Ghdl_Untruncated_Text_Read; diff --git a/src/grt/grt-files_operations.ads b/src/grt/grt-files_operations.ads index c6ee8751d..176d4f06c 100644 --- a/src/grt/grt-files_operations.ads +++ b/src/grt/grt-files_operations.ads @@ -133,8 +133,8 @@ package Grt.Files_Operations is Length : out Std_Integer); procedure Ghdl_Untruncated_Text_Read (File : Ghdl_File_Index; - Str : Std_String_Ptr; - Len : out Std_Integer; + Buf : Ghdl_C_String; + Len : in out Std_Integer; Status : out Op_Status); procedure Ghdl_Text_File_Close (File : Ghdl_File_Index; |