blob: f92455ed5178914ddc1857a54e13d2d5b7d548a8 [file] [log] [blame]
Nico Huber3a5cd8c2023-11-27 17:38:06 +01001with Interfaces.C;
2
3use Interfaces.C;
4
5package body FS.FILO is
6
7 C_Part_Length : unsigned_long
8 with
9 Import => True,
10 Convention => C,
11 External_Name => "part_length";
12
13 C_File_Max : int
14 with
15 Import => True,
16 Convention => C,
17 External_Name => "filemax";
18
19 C_File_Pos : int
20 with
21 Import => True,
22 Convention => C,
23 External_Name => "filepos";
24
25 function Part_Length return Partition_Length is (Partition_Length (C_Part_Length));
26
27 function File_Max return File_Length is
28 begin
29 if C_File_Max < 0 then
30 return 0;
31 end if;
32
33 return File_Length (C_File_Max);
34 end File_Max;
35
36 procedure Set_File_Max (Len : File_Length) is
37 begin
38 C_File_Max := int (Len);
39 end Set_File_Max;
40
41 function File_Pos return File_Offset is
42 begin
43 if C_File_Pos < 0 then
44 return 0;
45 end if;
46
47 return File_Offset (C_File_Pos);
48 end File_Pos;
49
50 procedure Set_File_Pos (Off : File_Offset) is
51 begin
52 C_File_Pos := int (Off);
53 end Set_File_Pos;
54
55end FS.FILO;