Thomas Heijligen | 5c43abc | 2023-12-11 15:24:36 +0000 | [diff] [blame] | 1 | package body FILO.FS is |
Nico Huber | 3a5cd8c | 2023-11-27 17:38:06 +0100 | [diff] [blame] | 2 | |
| 3 | C_Part_Length : unsigned_long |
| 4 | with |
| 5 | Import => True, |
| 6 | Convention => C, |
| 7 | External_Name => "part_length"; |
| 8 | |
| 9 | C_File_Max : int |
| 10 | with |
| 11 | Import => True, |
| 12 | Convention => C, |
| 13 | External_Name => "filemax"; |
| 14 | |
| 15 | C_File_Pos : int |
| 16 | with |
| 17 | Import => True, |
| 18 | Convention => C, |
| 19 | External_Name => "filepos"; |
| 20 | |
Nico Huber | f9ab868 | 2024-01-29 16:32:02 +0100 | [diff] [blame] | 21 | function Part_Len return Partition_Length |
| 22 | is |
| 23 | (Partition_Length (unsigned_long'Min ( |
| 24 | C_Part_Length, unsigned_long (Partition_Length'Last)))); |
Nico Huber | 3a5cd8c | 2023-11-27 17:38:06 +0100 | [diff] [blame] | 25 | |
| 26 | function File_Max return File_Length is |
| 27 | begin |
| 28 | if C_File_Max < 0 then |
| 29 | return 0; |
| 30 | end if; |
| 31 | |
| 32 | return File_Length (C_File_Max); |
| 33 | end File_Max; |
| 34 | |
| 35 | procedure Set_File_Max (Len : File_Length) is |
| 36 | begin |
| 37 | C_File_Max := int (Len); |
| 38 | end Set_File_Max; |
| 39 | |
| 40 | function File_Pos return File_Offset is |
| 41 | begin |
| 42 | if C_File_Pos < 0 then |
| 43 | return 0; |
| 44 | end if; |
| 45 | |
| 46 | return File_Offset (C_File_Pos); |
| 47 | end File_Pos; |
| 48 | |
| 49 | procedure Set_File_Pos (Off : File_Offset) is |
| 50 | begin |
| 51 | C_File_Pos := int (Off); |
| 52 | end Set_File_Pos; |
| 53 | |
Thomas Heijligen | 5c43abc | 2023-12-11 15:24:36 +0000 | [diff] [blame] | 54 | end FILO.FS; |