hac_0.40.0_79206bbb/src/manage/hac_sys-files-default.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
with Ada.Containers.Indefinite_Hashed_Maps,
     Ada.Strings.Hash,
     Ada.Text_IO;

package HAC_Sys.Files.Default is

  --  This implementation deals with "physical" text files, without a search path.

  type File_Catalogue is limited new Files.Abstract_File_Catalogue with private;

  overriding function Exists (cat : File_Catalogue; name : String) return Boolean;

  overriding function Full_Source_Name (cat : File_Catalogue; name : String) return String;

  overriding function Full_Spec_Source_Name (cat : File_Catalogue; name : String) return String;

  overriding function Full_Body_Source_Name (cat : File_Catalogue; name : String) return String;

  overriding function Is_Open (cat : File_Catalogue; name : String) return Boolean;

  overriding procedure Source_Open
    (cat    : in out File_Catalogue;
     name   : in     String;
     stream :    out Root_Stream_Class_Access);

  overriding procedure Skip_Shebang
    (cat            : in out File_Catalogue;
     name           : in     String;
     shebang_offset :    out Natural);

  overriding procedure Close (cat : in out File_Catalogue; name : String);

private

  type Text_File_Access is access Ada.Text_IO.File_Type;

  package Default_File_Name_Mapping is new Ada.Containers.Indefinite_Hashed_Maps
    (Key_Type        => String,
     Element_Type    => Text_File_Access,
     Hash            => Ada.Strings.Hash,
     Equivalent_Keys => "=");

  type File_Catalogue is limited new Files.Abstract_File_Catalogue with record
    read_open_map : Default_File_Name_Mapping.Map;
  end record;

end HAC_Sys.Files.Default;