2 package body Unc_Memops is
4 use type System.Address;
6 type Addr_Array_T is array (1 .. 20) of Addr_T;
8 type Addr_Stack_T is record
13 procedure Push (Addr : Addr_T; As : access addr_stack_t) is
15 As.Size := As.Size + 1;
16 As.Store (As.Size) := Addr;
19 function Pop (As : access Addr_Stack_T) return Addr_T is
20 Addr : Addr_T := As.Store (As.Size);
22 As.Size := As.Size - 1;
28 Addr_Stack : aliased Addr_Stack_T;
29 Symetry_Expected : Boolean := False;
31 procedure Expect_Symetry (Status : Boolean) is
33 Symetry_Expected := Status;
36 function Alloc (Size : size_t) return Addr_T is
37 function malloc (Size : Size_T) return Addr_T;
38 pragma Import (C, Malloc, "malloc");
40 Ptr : Addr_T := malloc (Size);
42 if Symetry_Expected then
43 Push (Ptr, Addr_Stack'Access);
48 procedure Free (Ptr : addr_t) is
51 and then Ptr /= Pop (Addr_Stack'Access)
57 function Realloc (Ptr : addr_t; Size : size_t) return Addr_T is
60 return System.Null_Address;