aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-12-14 19:14:03 +0100
committerTristan Gingold <tgingold@free.fr>2018-12-14 19:14:03 +0100
commit9ef4ebe51b7290e363cedaf0c2cbf72ccef2443f (patch)
treeb08899b53f097a770bb0ee8a06fbff23ebef0f52 /src
parentd679149045aaf9eab462b98f67d4064791e2ff40 (diff)
downloadghdl-9ef4ebe51b7290e363cedaf0c2cbf72ccef2443f.tar.gz
ghdl-9ef4ebe51b7290e363cedaf0c2cbf72ccef2443f.tar.bz2
ghdl-9ef4ebe51b7290e363cedaf0c2cbf72ccef2443f.zip
files_map: renaming for consistency.
Diffstat (limited to 'src')
-rw-r--r--src/files_map-editor.adb6
-rw-r--r--src/files_map.adb27
-rw-r--r--src/files_map.ads7
-rw-r--r--src/ghdldrv/ghdlprint.adb2
-rw-r--r--src/libraries.adb4
-rw-r--r--src/vhdl/errorout.adb2
-rw-r--r--src/vhdl/python/libghdl/thin.py6
-rw-r--r--src/vhdl/simulate/simul-debugger.adb4
-rw-r--r--src/vhdl/std_package.adb2
9 files changed, 32 insertions, 28 deletions
diff --git a/src/files_map-editor.adb b/src/files_map-editor.adb
index f8ed6b10b..06b5d3385 100644
--- a/src/files_map-editor.adb
+++ b/src/files_map-editor.adb
@@ -165,7 +165,7 @@ package body Files_Map.Editor is
end if;
New_Start := F.File_Length + 2;
else
- New_Start := Line_To_Position (File, Line + 1);
+ New_Start := File_Line_To_Position (File, Line + 1);
if New_Start = F.Gap_Last + 1 then
-- No move (the gap is already at end of LINE).
return;
@@ -265,9 +265,9 @@ package body Files_Map.Editor is
-- The gap has moved, so every offset may have changed...
declare
Start_Pos : constant Source_Ptr :=
- Line_To_Position (File, Start_Line) + Source_Ptr (Start_Off);
+ File_Line_To_Position (File, Start_Line) + Source_Ptr (Start_Off);
End_Pos : constant Source_Ptr :=
- Line_To_Position (File, End_Line) + Source_Ptr (End_Off);
+ File_Line_To_Position (File, End_Line) + Source_Ptr (End_Off);
Text_Len : constant Source_Ptr := Text'Length;
Gap_Size : constant Source_Ptr := F.Gap_Last - F.Gap_Start + 1;
Range_Size : Source_Ptr;
diff --git a/src/files_map.adb b/src/files_map.adb
index 2a21f96b0..ba6573513 100644
--- a/src/files_map.adb
+++ b/src/files_map.adb
@@ -93,13 +93,12 @@ package body Files_Map is
return Source_Files.Table (File).First_Location + Location_Type (Pos);
end File_Pos_To_Location;
- function Source_File_To_Location (File : Source_File_Entry)
- return Location_Type
+ function File_To_Location (File : Source_File_Entry) return Location_Type
is
pragma Assert (File <= Source_Files.Last);
begin
return Source_Files.Table (File).First_Location;
- end Source_File_To_Location;
+ end File_To_Location;
-- Add a new entry in the lines_table.
-- The new entry must be the next one after the last entry.
@@ -279,7 +278,7 @@ package body Files_Map is
and then Pos < Lines_Table (Mid + 1))
or else Pos = Lines_Table (Mid)
or else (Hi <= Mid + 1
- and Lines_Table (Mid + 1) = Source_Ptr_Bad)
+ and Lines_Table (Mid + 1) = Source_Ptr_Bad)
then
return Mid;
end if;
@@ -534,7 +533,7 @@ package body Files_Map is
-- Find a source_file by DIRECTORY and NAME.
-- Return NO_SOURCE_FILE_ENTRY if not already opened.
function Find_Source_File (Directory : Name_Id; Name: Name_Id)
- return Source_File_Entry
+ return Source_File_Entry
is
begin
for I in Source_Files.First .. Source_Files.Last loop
@@ -550,7 +549,7 @@ package body Files_Map is
-- Return an entry for a filename.
-- The file is not loaded.
function Create_Source_File_Entry (Directory : Name_Id; Name: Name_Id)
- return Source_File_Entry
+ return Source_File_Entry
is
Res: Source_File_Entry;
begin
@@ -719,7 +718,7 @@ package body Files_Map is
-- Return an entry for a filename.
-- Load the filename if necessary.
function Read_Source_File (Directory : Name_Id; Name: Name_Id)
- return Source_File_Entry
+ return Source_File_Entry
is
use GNAT.OS_Lib;
Fd : File_Descriptor;
@@ -861,7 +860,7 @@ package body Files_Map is
-- Return a buffer (access to the contents of the file) for a file entry.
function Get_File_Source (File: Source_File_Entry)
- return File_Buffer_Acc is
+ return File_Buffer_Acc is
begin
Check_File (File);
return Source_Files.Table (File).Source;
@@ -911,14 +910,14 @@ package body Files_Map is
end Get_File_Checksum;
function Get_Source_File_Directory (File : Source_File_Entry)
- return Name_Id is
+ return Name_Id is
begin
Check_File (File);
return Source_Files.Table (File).Directory;
end Get_Source_File_Directory;
- function Line_To_Position (File : Source_File_Entry; Line : Positive)
- return Source_Ptr
+ function File_Line_To_Position (File : Source_File_Entry; Line : Positive)
+ return Source_Ptr
is
pragma Assert (File <= Source_Files.Last);
Source_File: Source_File_Record renames Source_Files.Table (File);
@@ -937,9 +936,9 @@ package body Files_Map is
return Source_Ptr_Org;
end if;
when Source_File_Instance =>
- return Line_To_Position (Source_File.Base, Line);
+ return File_Line_To_Position (Source_File.Base, Line);
end case;
- end Line_To_Position;
+ end File_Line_To_Position;
function Is_Eq (L : Time_Stamp_Id; R : Time_Stamp_Id) return Boolean
is
@@ -1097,7 +1096,7 @@ package body Files_Map is
function Extract_Expanded_Line (File : Source_File_Entry;
Line : Positive) return String
is
- Start : constant Source_Ptr := Line_To_Position (File, Line);
+ Start : constant Source_Ptr := File_Line_To_Position (File, Line);
begin
return Extract_Expanded_Line (File, Start);
end Extract_Expanded_Line;
diff --git a/src/files_map.ads b/src/files_map.ads
index 17b1d033c..db6a3969a 100644
--- a/src/files_map.ads
+++ b/src/files_map.ads
@@ -177,13 +177,12 @@ package Files_Map is
return Location_Type;
-- Convert a FILE into a location.
- function Source_File_To_Location (File : Source_File_Entry)
- return Location_Type;
+ function File_To_Location (File : Source_File_Entry) return Location_Type;
-- Convert a FILE+LINE into a position.
-- Return Source_Ptr_Bad in case of error (LINE out of bounds).
- function Line_To_Position (File : Source_File_Entry; Line : Positive)
- return Source_Ptr;
+ function File_Line_To_Position (File : Source_File_Entry; Line : Positive)
+ return Source_Ptr;
-- Translate LOCATION into coordinate (physical position).
-- FILE identifies the filename.
diff --git a/src/ghdldrv/ghdlprint.adb b/src/ghdldrv/ghdlprint.adb
index 4d367621c..6e75df65f 100644
--- a/src/ghdldrv/ghdlprint.adb
+++ b/src/ghdldrv/ghdlprint.adb
@@ -909,7 +909,7 @@ package body Ghdlprint is
Buf := Get_File_Source (File);
for J in 1 .. Line loop
- Ptr := Line_To_Position (File, J);
+ Ptr := File_Line_To_Position (File, J);
exit when Ptr = Source_Ptr_Bad;
exit when Buf (Ptr) = Files_Map.EOT;
diff --git a/src/libraries.adb b/src/libraries.adb
index e6f091e0f..4a12f825e 100644
--- a/src/libraries.adb
+++ b/src/libraries.adb
@@ -608,8 +608,8 @@ package body Libraries is
(Get_Identifier ("*libraries*"));
Command_Source_File := Create_Virtual_Source_File
(Get_Identifier ("*command line*"));
- Command_Line_Location := Source_File_To_Location (Command_Source_File);
- Library_Location := Source_File_To_Location (Library_Source_File);
+ Command_Line_Location := File_To_Location (Command_Source_File);
+ Library_Location := File_To_Location (Library_Source_File);
end Create_Virtual_Locations;
-- Note: the scanner shouldn't be in use, since this procedure uses it.
diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb
index cdeb28ee4..be02cea1c 100644
--- a/src/vhdl/errorout.adb
+++ b/src/vhdl/errorout.adb
@@ -62,7 +62,7 @@ package body Errorout is
is
Line_Pos : Source_Ptr;
begin
- Line_Pos := Line_To_Position (E.File, E.Line);
+ Line_Pos := File_Line_To_Position (E.File, E.Line);
return Coord_To_Col (E.File, Line_Pos, E.Offset);
end Get_Error_Col;
diff --git a/src/vhdl/python/libghdl/thin.py b/src/vhdl/python/libghdl/thin.py
index 4de91833d..19a823e7e 100644
--- a/src/vhdl/python/libghdl/thin.py
+++ b/src/vhdl/python/libghdl/thin.py
@@ -92,6 +92,12 @@ Location_File_Line_To_Offset = libghdl.files_map__location_file_line_to_offset
Location_File_Line_To_Col = libghdl.files_map__location_file_line_to_col
+File_To_Location = libghdl.files_map__file_to_location
+
+File_Pos_To_Location = libghdl.files_map__file_pos_to_location
+
+File_Line_To_Position = libghdl.files_map__file_line_to_position
+
Get_File_Name = libghdl.files_map__get_file_name
Get_File_Buffer = libghdl.files_map__get_file_buffer
diff --git a/src/vhdl/simulate/simul-debugger.adb b/src/vhdl/simulate/simul-debugger.adb
index 4ddf1130c..6747179e8 100644
--- a/src/vhdl/simulate/simul-debugger.adb
+++ b/src/vhdl/simulate/simul-debugger.adb
@@ -1061,7 +1061,7 @@ package body Simul.Debugger is
Line := 1;
end if;
- Pos := Line_To_Position (List_Current_File, Line);
+ Pos := File_Line_To_Position (List_Current_File, Line);
Buf := Get_File_Source (List_Current_File);
while Line < List_Current_Line + Radius loop
@@ -1121,7 +1121,7 @@ package body Simul.Debugger is
begin
Location_To_Coord (Loc, File, Line_Pos, Line, Offset);
Buf := Get_File_Source (File);
- Next_Line_Pos := Line_To_Position (File, Line + 1);
+ Next_Line_Pos := File_Line_To_Position (File, Line + 1);
Put (String (Buf (Line_Pos .. Next_Line_Pos - 1)));
end Disp_Source_Line;
diff --git a/src/vhdl/std_package.adb b/src/vhdl/std_package.adb
index 02f604936..ee6b8cdac 100644
--- a/src/vhdl/std_package.adb
+++ b/src/vhdl/std_package.adb
@@ -82,7 +82,7 @@ package body Std_Package is
end Create_Known_Iir;
begin
Std_Filename := Name_Table.Get_Identifier ("*std_standard*");
- Std_Location := Files_Map.Source_File_To_Location
+ Std_Location := Files_Map.File_To_Location
(Files_Map.Create_Virtual_Source_File (Std_Filename));
if Create_Iir_Error /= Error_Mark then