text
stringlengths 0
234
|
|---|
-- Generic_Write --
|
-------------------
|
function Generic_Write
|
(File : File_Descriptor;
|
Value : T)
|
return Status_Code
|
is
|
begin
|
if File.Handle /= null then
|
return Convert (File.Handle.Write (Value'Address, T'Size / 8));
|
else
|
return Invalid_Parameter;
|
end if;
|
end Generic_Write;
|
------------------
|
-- Generic_Read --
|
------------------
|
function Generic_Read
|
(File : File_Descriptor;
|
Value : out T)
|
return Status_Code
|
is
|
L : HALFS.File_Size := T'Size / 8;
|
begin
|
if File.Handle /= null then
|
return Convert (File.Handle.Read (Value'Address, L));
|
else
|
return Invalid_Parameter;
|
end if;
|
end Generic_Read;
|
----------
|
-- Open --
|
----------
|
function Open
|
(Dir : in out Directory_Descriptor;
|
Name : String)
|
return Status_Code
|
is
|
Ret : Status_Code;
|
begin
|
if Dir.Handle /= null then
|
return Invalid_Parameter;
|
end if;
|
Ret := Open (Name, Dir.Handle);
|
if Ret /= OK then
|
Dir.Handle := null;
|
end if;
|
return Ret;
|
end Open;
|
-----------
|
-- Close --
|
-----------
|
procedure Close (Dir : in out Directory_Descriptor) is
|
begin
|
if Dir.Handle /= null then
|
Dir.Handle.Close;
|
end if;
|
end Close;
|
----------
|
-- Read --
|
----------
|
function Read (Dir : in out Directory_Descriptor)
|
return Directory_Entry
|
is
|
Node : Any_Node_Handle;
|
Status : Status_Code;
|
begin
|
if Dir.Handle = null then
|
return Invalid_Dir_Entry;
|
end if;
|
Status := Convert (Dir.Handle.Read (Node));
|
if Status /= OK then
|
return Invalid_Dir_Entry;
|
end if;
|
declare
|
Name : constant String := Node.Basename;
|
Ret : Directory_Entry (Name_Length => Name'Length);
|
begin
|
Ret.Name := Name;
|
Ret.Subdirectory := Node.Is_Subdirectory;
|
Ret.Read_Only := Node.Is_Read_Only;
|
Ret.Hidden := Node.Is_Hidden;
|
Ret.Symlink := Node.Is_Symlink;
|
Ret.Size := Convert (Node.Size);
|
Node.Close;
|
return Ret;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.