diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-05-11 08:49:23 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-05-11 18:13:39 +0200 |
commit | 516a716de3bdee436de54a17f1ec5b794677e076 (patch) | |
tree | 31aac612d825cc9aeee02e58a6eec75f35d531e9 /src | |
parent | b90428658802f4aafb8c77e96937383f849bec34 (diff) | |
download | ghdl-516a716de3bdee436de54a17f1ec5b794677e076.tar.gz ghdl-516a716de3bdee436de54a17f1ec5b794677e076.tar.bz2 ghdl-516a716de3bdee436de54a17f1ec5b794677e076.zip |
files_map: add location_to_coord.
Diffstat (limited to 'src')
-rw-r--r-- | src/files_map.adb | 24 | ||||
-rw-r--r-- | src/files_map.ads | 7 |
2 files changed, 23 insertions, 8 deletions
diff --git a/src/files_map.adb b/src/files_map.adb index 45e35586b..e93934ce2 100644 --- a/src/files_map.adb +++ b/src/files_map.adb @@ -354,17 +354,12 @@ package body Files_Map is Coord_To_Position (File, Line_Pos, Offset, Name, Col); end Location_To_Position; - procedure Location_To_Coord (Location : Location_Type; - File : out Source_File_Entry; + procedure File_Pos_To_Coord (File : Source_File_Entry; + Pos : Source_Ptr; Line_Pos : out Source_Ptr; Line : out Positive; - Offset : out Natural) - is - Pos : Source_Ptr; + Offset : out Natural) is begin - -- Get FILE and position POS in the file. - Location_To_File_Pos (Location, File, Pos); - case Source_Files.Table (File).Kind is when Source_File_File => Location_To_Coord (Source_Files.Table (File), Pos, @@ -382,6 +377,19 @@ package body Files_Map is Line_Pos, Line, Offset); end; end case; + end File_Pos_To_Coord; + + procedure Location_To_Coord (Location : Location_Type; + File : out Source_File_Entry; + Line_Pos : out Source_Ptr; + Line : out Positive; + Offset : out Natural) + is + Pos : Source_Ptr; + begin + -- Get FILE and position POS in the file. + Location_To_File_Pos (Location, File, Pos); + File_Pos_To_Coord (File, Pos, Line_Pos, Line, Offset); end Location_To_Coord; function Location_File_To_Pos diff --git a/src/files_map.ads b/src/files_map.ads index 1e69ed572..a5a05e30e 100644 --- a/src/files_map.ads +++ b/src/files_map.ads @@ -195,6 +195,13 @@ package Files_Map is Line : out Positive; Offset : out Natural); + -- Convert FILE and POS to coordinate. + procedure File_Pos_To_Coord (File : Source_File_Entry; + Pos : Source_Ptr; + Line_Pos : out Source_Ptr; + Line : out Positive; + Offset : out Natural); + -- Convert a physical column to a logical column. -- A physical column is the offset in byte from the first byte of the line. -- A logical column is the position of the character when displayed. |