From 6b3ec4018544c67a086ee2d70321b3b225f6a178 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 23 Nov 2018 19:32:00 +0100 Subject: files_map: use Positive for lines. --- src/files_map.adb | 24 ++++++++++++------------ src/files_map.ads | 18 +++++++++--------- 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/files_map.adb b/src/files_map.adb index 328914b97..b8e9311ff 100644 --- a/src/files_map.adb +++ b/src/files_map.adb @@ -104,7 +104,7 @@ package body Files_Map is -- Add a new entry in the lines_table. -- The new entry must be the next one after the last entry. procedure File_Add_Line_Number - (File: Source_File_Entry; Line: Natural; Pos: Source_Ptr) + (File : Source_File_Entry; Line : Positive; Pos : Source_Ptr) is use Lines_Tables; @@ -340,7 +340,7 @@ package body Files_Map is procedure Location_To_Position (Location : Location_Type; Name : out Name_Id; - Line : out Natural; + Line : out Positive; Col : out Natural) is File : Source_File_Entry; @@ -354,7 +354,7 @@ package body Files_Map is procedure Location_To_Coord (Location : Location_Type; File : out Source_File_Entry; Line_Pos : out Source_Ptr; - Line : out Natural; + Line : out Positive; Offset : out Natural) is Pos : Source_Ptr; @@ -388,11 +388,11 @@ package body Files_Map is end Location_File_To_Pos; function Location_File_To_Line - (Location : Location_Type; File : Source_File_Entry) return Natural + (Location : Location_Type; File : Source_File_Entry) return Positive is Line_Pos : Source_Ptr; - Line : Natural; - Offset : Natural; + Line : Positive; + Offset : Natural; begin Location_To_Coord (Source_Files.Table (File), Location_File_To_Pos (Location, File), @@ -401,7 +401,7 @@ package body Files_Map is end Location_File_To_Line; function Location_File_Line_To_Col - (Loc : Location_Type; File : Source_File_Entry; Line : Natural) + (Loc : Location_Type; File : Source_File_Entry; Line : Positive) return Natural is F : Source_File_Record renames Source_Files.Table (File); @@ -850,7 +850,7 @@ package body Files_Map is begin pragma Assert (Length <= Buffer'Length - 2); - F.File_Length := Natural (Length); + F.File_Length := Length; Buffer (Source_Ptr_Org + Length) := EOT; Buffer (Source_Ptr_Org + Length + 1) := EOT; end; @@ -860,7 +860,7 @@ package body Files_Map is function Get_File_Length (File: Source_File_Entry) return Source_Ptr is begin Check_File (File); - return Source_Ptr (Source_Files.Table (File).File_Length); + return Source_Files.Table (File).File_Length; end Get_File_Length; -- Return the name of the file. @@ -884,7 +884,7 @@ package body Files_Map is return Source_Files.Table (File).Directory; end Get_Source_File_Directory; - function Line_To_Position (File : Source_File_Entry; Line : Natural) + function Line_To_Position (File : Source_File_Entry; Line : Positive) return Source_Ptr is pragma Assert (File <= Source_Files.Last); @@ -1062,7 +1062,7 @@ package body Files_Map is end Extract_Expanded_Line; function Extract_Expanded_Line (File : Source_File_Entry; - Line : Natural) return String + Line : Positive) return String is Start : constant Source_Ptr := Line_To_Position (File, Line); begin @@ -1102,7 +1102,7 @@ package body Files_Map is Put (Source_File_Entry'Image (I)); Put (" name: " & Image (F.File_Name)); Put (" dir:" & Image (F.Directory)); - Put (" length:" & Natural'Image (F.File_Length)); + Put (" length:" & Source_Ptr'Image (F.File_Length)); New_Line; Put (" location:" & Location_Type'Image (F.First_Location) & " -" & Location_Type'Image (F.Last_Location)); diff --git a/src/files_map.ads b/src/files_map.ads index 2b0f87339..411195b4a 100644 --- a/src/files_map.ads +++ b/src/files_map.ads @@ -137,7 +137,7 @@ package Files_Map is -- Add a new entry in the lines_table. -- The new entry must be the next one after the last entry. procedure File_Add_Line_Number - (File : Source_File_Entry; Line : Natural; Pos : Source_Ptr); + (File : Source_File_Entry; Line : Positive; Pos : Source_Ptr); -- Convert LOCATION to a source file. Return No_Source_File_Entry if -- LOCATION is incorrect. @@ -150,11 +150,11 @@ package Files_Map is -- Convert LOCATION and FILE to a line number. function Location_File_To_Line - (Location : Location_Type; File : Source_File_Entry) return Natural; + (Location : Location_Type; File : Source_File_Entry) return Positive; -- Get logical column (with HT expanded) from LOC, FILE and LINE. function Location_File_Line_To_Col - (Loc : Location_Type; File : Source_File_Entry; Line : Natural) + (Loc : Location_Type; File : Source_File_Entry; Line : Positive) return Natural; -- Convert LOCATION into a source file FILE and an offset POS in the @@ -173,7 +173,7 @@ package Files_Map is -- 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 : Natural) + function Line_To_Position (File : Source_File_Entry; Line : Positive) return Source_Ptr; -- Translate LOCATION into coordinate (physical position). @@ -185,7 +185,7 @@ package Files_Map is procedure Location_To_Coord (Location : Location_Type; File : out Source_File_Entry; Line_Pos : out Source_Ptr; - Line : out Natural; + Line : out Positive; Offset : out Natural); -- Convert a physical column to a logical column. @@ -212,14 +212,14 @@ package Files_Map is -- It is like to two procedures above. procedure Location_To_Position (Location : Location_Type; Name : out Name_Id; - Line : out Natural; + Line : out Positive; Col : out Natural); -- Return the line LINE from FILE (without end of line). The line is -- expanded: tabs are replaced by spaces according to Tab_Stop. This -- function is slow. function Extract_Expanded_Line (File : Source_File_Entry; - Line : Natural) return String; + Line : Positive) return String; -- Return the image of LOC using the "FILENAME:LINE:COL" format or -- "LINE:COL" format if FILENAME is false; @@ -267,7 +267,7 @@ private Source : File_Buffer_Acc; -- Length of the file, which is less than the length of the buffer. - File_Length : Natural; + File_Length : Source_Ptr; Checksum : File_Checksum_Id; @@ -278,7 +278,7 @@ private Lines : Lines_Tables.Instance; -- Cache for line table. - Cache_Line : Natural; + Cache_Line : Positive; Cache_Pos : Source_Ptr; when Source_File_String => -- cgit v1.2.3