aboutsummaryrefslogtreecommitdiffstats
path: root/src/files_map.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-06-03 18:28:31 +0200
committerTristan Gingold <tgingold@free.fr>2019-06-03 18:28:31 +0200
commit296a2651cfe3ab9e66ed2562e5599afee3776027 (patch)
tree5f992a1f95ba885b57ae07bf317e5c65b9661d22 /src/files_map.adb
parent9019ecb269279a658a720a1d3f4a2340003995b8 (diff)
downloadghdl-296a2651cfe3ab9e66ed2562e5599afee3776027.tar.gz
ghdl-296a2651cfe3ab9e66ed2562e5599afee3776027.tar.bz2
ghdl-296a2651cfe3ab9e66ed2562e5599afee3776027.zip
files_map: add get_buffer_length
Diffstat (limited to 'src/files_map.adb')
-rw-r--r--src/files_map.adb11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/files_map.adb b/src/files_map.adb
index d6ee415b1..fc7ba06e9 100644
--- a/src/files_map.adb
+++ b/src/files_map.adb
@@ -717,7 +717,7 @@ package body Files_Map is
-- Read_Source_File call must follow its Create_Source_File.
pragma Assert (F.First_Location = Next_Location);
- F.Last_Location := Next_Location + Location_Type (Length) + 1;
+ F.Last_Location := Next_Location + Location_Type (Length) - 1;
Next_Location := F.Last_Location + 1;
end;
@@ -897,13 +897,20 @@ package body Files_Map is
end;
end Set_File_Length;
- -- Return the length of the file (which is the size of the file buffer).
function Get_File_Length (File: Source_File_Entry) return Source_Ptr is
begin
Check_File (File);
return Source_Files.Table (File).File_Length;
end Get_File_Length;
+ function Get_Buffer_Length (File : Source_File_Entry) return Source_Ptr
+ is
+ pragma Assert (File <= Source_Files.Last);
+ F : Source_File_Record renames Source_Files.Table (File);
+ begin
+ return Source_Ptr (F.Last_Location - F.First_Location - 1);
+ end Get_Buffer_Length;
+
-- Return the name of the file.
function Get_File_Name (File: Source_File_Entry) return Name_Id is
begin