text
stringlengths
0
234
(Object.Data'Length);
function "&" (Left, Right : Reference) return String is
(Left.Data.all & Right.Data.all);
function "&" (Left : Reference; Right : String) return String is
(Left.Data.all & Right);
function "&" (Left : Reference; Right : Character) return String is
(Left.Data.all & Right);
function "&" (Left : String; Right : Reference) return String is
(Left & Right.Data.all);
function "&" (Left : Character; Right : Reference) return String is
(Left & Right.Data.all);
function "=" (Left, Right : Reference) return Boolean is
(Left.Data = Right.Data or else
(Left.Data /= null and then Right.Data /= null and then
Left.Data.all = Right.Data.all));
function "=" (Left : Reference; Right : String) return Boolean is
(Left.Data.all = Right);
function Hash (Object : Reference) return Ada.Containers.Hash_Type is
(Ada.Strings.Hash (Object.Data.all));
function "=" (Left : String; Right : Reference) return Boolean is
(Left = Right.Data.all);
function Element (Object : Reference; Position : Positive) return Character
is (Object.Data (Position));
function Hold (Content : String) return Constant_Instance is
Ret : Constant_Instance :=
(Length => Content'Length + Positive (Header_Size) + 1,
Data => <>);
H : Header with Import;
for H'Address use Ret.Data (1)'Address;
begin
H.Pool := null;
H.Refcount := 1;
H.First := 1;
H.Last := Content'Length;
Ret.Data (Positive (Header_Size) + 1 .. Ret.Data'Last) :=
Content & Character'Val (0);
return Ret;
end Hold;
procedure Adjust (Object : in out Reference) is
begin
if Object.Data /= null then
declare
H : constant access Header := Header_Of (Object.Data);
begin
if H.Pool /= null then
H.Refcount := H.Refcount + 1;
end if;
Function Definition: procedure Free_Chunk is new Ada.Unchecked_Deallocation
Function Body: (Pool_Array, Chunk);
procedure Free_Data is new Ada.Unchecked_Deallocation
(Pool_Data, Pool_Data_Access);
begin
Pool.Usage (Chunk_Index) := Pool.Usage (Chunk_Index) - 1;
if Pool.Usage (Chunk_Index) = 0 then
Free_Chunk (Pool.Chunks (Chunk_Index));
for I in Chunk_Index_Type loop
if Pool.Chunks (I) /= null then
return;
end if;
end loop;
Free_Data (Pool);
end if;
end Decrease_Usage;
procedure Finalize (Object : in out Reference) is
Reference : constant UTF_8_String_Access := Object.Data;
begin
Object.Data := null;
if Reference /= null then
declare
H : constant not null access Header := Header_Of (Reference);
begin
if H.Pool /= null then
H.Refcount := H.Refcount - 1;
if H.Refcount = 0 then
H.Last := Round_To_Header_Size (H.Last + 1);
Decrease_Usage (H.Pool, H.Chunk_Index);
end if;
end if;
Function Definition: procedure test_Conversion_Type is
Function Body: package conversion_float is new Conversion_Type(T_Element => float);
use conversion_float;
-- Tester la procedure de conversion en entier
procedure test_To_Integer is
useless : Integer;