diff options
-rw-r--r-- | src/files_map.adb | 72 | ||||
-rw-r--r-- | src/files_map.ads | 73 |
2 files changed, 73 insertions, 72 deletions
diff --git a/src/files_map.adb b/src/files_map.adb index 28c569e0c..328914b97 100644 --- a/src/files_map.adb +++ b/src/files_map.adb @@ -17,7 +17,6 @@ -- 02111-1307, USA. with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; -with Tables; with GNAT.OS_Lib; with GNAT.SHA1; with GNAT.Directory_Operations; @@ -25,7 +24,6 @@ with Name_Table; use Name_Table; with Str_Table; with Ada.Calendar; with Ada.Calendar.Time_Zones; -with Dyn_Tables; package body Files_Map is @@ -34,79 +32,9 @@ package body Files_Map is procedure Check_File (File: in Source_File_Entry); pragma Inline (Check_File); - package Lines_Tables is new Dyn_Tables - (Table_Component_Type => Source_Ptr, - Table_Index_Type => Natural, - Table_Low_Bound => 1, - Table_Initial => 64); - - -- There are several kinds of source file. - type Source_File_Kind is - ( - -- A *real* source file, read from the filesystem. - Source_File_File, - - -- A virtual source file, created from a string. - Source_File_String, - - -- A duplicated source file (there is no copy however), created by - -- an instantiation. - Source_File_Instance); - - -- Data associed with a file. - type Source_File_Record (Kind : Source_File_Kind := Source_File_File) is - record - -- All location between first and last belong to this file. - First_Location : Location_Type; - Last_Location : Location_Type; - - -- The name_id that identify this file. - -- FIXME: what about file aliasing (links) ? - File_Name : Name_Id; - - Directory : Name_Id; - - -- The buffer containing the file. - Source : File_Buffer_Acc; - - -- Length of the file, which is less than the length of the buffer. - File_Length : Natural; - - Checksum : File_Checksum_Id; - - case Kind is - when Source_File_File => - -- Line table - - Lines : Lines_Tables.Instance; - - -- Cache for line table. - Cache_Line : Natural; - Cache_Pos : Source_Ptr; - - when Source_File_String => - -- There is only one line. - null; - - when Source_File_Instance => - -- The instance was created from REF. - Ref : Source_File_Entry; - -- The ultimate non-instance is BASE. - Base : Source_File_Entry; - - Instance_Loc : Location_Type; - end case; - end record; - -- Next location to use. Next_Location : Location_Type := Location_Nil + 1; - package Source_Files is new Tables - (Table_Index_Type => Source_File_Entry, - Table_Component_Type => Source_File_Record, - Table_Low_Bound => No_Source_File_Entry + 1, - Table_Initial => 16); - function Get_Last_Source_File_Entry return Source_File_Entry is begin return Source_Files.Last; diff --git a/src/files_map.ads b/src/files_map.ads index 0c2fc7aad..2b0f87339 100644 --- a/src/files_map.ads +++ b/src/files_map.ads @@ -16,6 +16,8 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Types; use Types; +with Tables; +with Dyn_Tables; with Nodes; -- Source file handling @@ -228,6 +230,77 @@ package Files_Map is procedure Initialize; private + package Lines_Tables is new Dyn_Tables + (Table_Component_Type => Source_Ptr, + Table_Index_Type => Natural, + Table_Low_Bound => 1, + Table_Initial => 64); + + -- There are several kinds of source file. + type Source_File_Kind is + ( + -- A *real* source file, read from the filesystem. + Source_File_File, + + -- A virtual source file, created from a string. + Source_File_String, + + -- A duplicated source file (there is no copy however), created by + -- an instantiation. + Source_File_Instance + ); + + -- Data associed with a file. + type Source_File_Record (Kind : Source_File_Kind := Source_File_File) is + record + -- All location between first and last belong to this file. + First_Location : Location_Type; + Last_Location : Location_Type; + + -- The name_id that identify this file. + -- FIXME: what about file aliasing (links) ? + File_Name : Name_Id; + + Directory : Name_Id; + + -- The buffer containing the file. + Source : File_Buffer_Acc; + + -- Length of the file, which is less than the length of the buffer. + File_Length : Natural; + + Checksum : File_Checksum_Id; + + case Kind is + when Source_File_File => + -- Line table + + Lines : Lines_Tables.Instance; + + -- Cache for line table. + Cache_Line : Natural; + Cache_Pos : Source_Ptr; + + when Source_File_String => + -- There is only one line. + null; + + when Source_File_Instance => + -- The instance was created from REF. + Ref : Source_File_Entry; + -- The ultimate non-instance is BASE. + Base : Source_File_Entry; + + Instance_Loc : Location_Type; + end case; + end record; + + package Source_Files is new Tables + (Table_Index_Type => Source_File_Entry, + Table_Component_Type => Source_File_Record, + Table_Low_Bound => No_Source_File_Entry + 1, + Table_Initial => 16); + -- Debug procedures. -- Disp info about all source files |