hcl/lib/h2-sysapi.ads

104 lines
4.0 KiB
Ada
Raw Normal View History

2014-06-02 15:25:42 +00:00
generic
type Slim_Character is (<>);
type Wide_Character is (<>);
type Slim_String is array(System_Index range<>) of Slim_Character;
type Wide_String is array(System_Index range<>) of Wide_Character;
with function Slim_To_Wide (Slim: in Slim_String) return Wide_String;
with function Wide_To_Slim (Wide: in Wide_String) return Slim_String;
package H2.Sysapi is
2014-06-04 17:15:52 +00:00
2014-06-02 15:25:42 +00:00
type File_Flag_Bits is new System_Word;
2014-06-04 17:15:52 +00:00
type File_Flag_Record is record
2014-06-02 15:25:42 +00:00
Bits: File_Flag_Bits := 0;
end record;
2014-06-02 15:25:42 +00:00
type File_Mode_Bits is new System_Word;
2014-06-04 17:15:52 +00:00
type File_Mode_Record is record
2014-06-02 15:25:42 +00:00
Bits: File_Mode_Bits := 0;
end record;
2014-06-04 17:15:52 +00:00
procedure Set_File_Flag_Bits (Flag: in out File_Flag_Record; Bits: in File_Flag_Bits);
procedure Clear_File_Flag_Bits (Flag: in out File_Flag_Record; Bits: in File_Flag_Bits);
package File is
2014-06-04 17:15:52 +00:00
type File_Record is tagged null record;
type File_Pointer is access all File_Record'Class;
subtype Flag_Bits is Sysapi.File_Flag_Bits;
subtype Mode_Bits is Sysapi.File_Mode_Bits;
subtype Flag_Record is Sysapi.File_Flag_Record;
subtype Mode_Record is Sysapi.File_Mode_Record;
FLAG_READ: constant Flag_Bits := 2#0000_0000_0000_0001#;
FLAG_WRITE: constant Flag_Bits := 2#0000_0000_0000_0010#;
FLAG_CREATE: constant Flag_Bits := 2#0000_0000_0000_0100#;
FLAG_EXCLUSIVE: constant Flag_Bits := 2#0000_0000_0000_1000#;
FLAG_TRUNCATE: constant Flag_Bits := 2#0000_0000_0001_0000#;
FLAG_APPEND: constant Flag_Bits := 2#0000_0000_0010_0000#;
FLAG_NONBLOCK: constant Flag_Bits := 2#0000_0000_0100_0000#;
FLAG_SYNC: constant Flag_Bits := 2#0000_0000_1000_0000#;
FLAG_NOFOLLOW: constant Flag_Bits := 2#0000_0001_0000_0000#;
-- FLAG_NOSHREAD: constant Flag_Bits := 2#0010_0000_0000_0000#;
-- FLAG_NOSHWRITE: constant Flag_Bits := 2#0100_0000_0000_0000#;
-- FLAG_NOSHDELETE: constant Flag_Bits := 2#1000_0000_0000_0000#;
MODE_OWNER_READ: constant Mode_Bits := 2#100_000_000#;
MODE_OWNER_WRITE: constant Mode_Bits := 2#010_000_000#;
MODE_OWNER_EXEC: constant Mode_Bits := 2#001_000_000#;
MODE_GROUP_READ: constant Mode_Bits := 2#000_100_000#;
MODE_GROUP_WRITE: constant Mode_Bits := 2#000_010_000#;
MODE_GROUP_EXEC: constant Mode_Bits := 2#000_001_000#;
MODE_OTHER_READ: constant Mode_Bits := 2#000_000_100#;
MODE_OTHER_WRITE: constant Mode_Bits := 2#000_000_010#;
MODE_OTHER_EXEC: constant Mode_Bits := 2#000_000_001#;
DEFAULT_MODE: constant Mode_Record := ( Bits => 2#110_100_100# );
procedure Set_Flag_Bits (Flag: in out Flag_Record;
Bits: in Flag_Bits) renames Sysapi.Set_File_Flag_Bits;
procedure Clear_Flag_Bits (Flag: in out Flag_Record;
Bits: in Flag_Bits) renames Sysapi.Clear_File_Flag_Bits;
function Get_Stdin return File_Pointer;
function Get_Stdout return File_Pointer;
function Get_Stderr return File_Pointer;
2014-06-02 15:25:42 +00:00
procedure Open (File: out File_Pointer;
Name: in Slim_String;
2014-06-04 17:15:52 +00:00
Flag: in Flag_Record;
Mode: in Mode_Record := DEFAULT_MODE;
Pool: in Storage_Pool_Pointer := null);
procedure Open (File: out File_Pointer;
Name: in Wide_String;
2014-06-04 17:15:52 +00:00
Flag: in Flag_Record;
Mode: in Mode_Record := DEFAULT_MODE;
Pool: in Storage_Pool_Pointer := null);
procedure Close (File: in out File_Pointer);
2014-06-04 17:15:52 +00:00
procedure Read (File: in File_Pointer;
Buffer: in out System_Byte_Array;
Last: out System_Length);
procedure Write (File: in File_Pointer;
Buffer: in System_Byte_Array;
Last: out System_Length);
pragma Inline (Get_Stdin);
pragma Inline (Get_Stdout);
pragma Inline (Get_Stderr);
end File;
2014-06-02 15:25:42 +00:00
--procedure Open_File (File: out File_Pointer;
-- Flag: in Flag_Record;
-- Mode: in Mode_Record) renames File.Open;
--procedure Close_File (File: in out File_Pointer) renames File.Close;
end H2.Sysapi;