File : store.adb
package body Store is
pragma Inline (Hash);
Nothing: constant Index := Empty;
procedure Make_Empty_Table is
pragma Suppress(Storage_Check);
begin
if Table=null then Table := new SVPrim; end if;
for Pos in Table'Range loop
Table(Pos).FaceId0 := Nothing;
Table(Pos).FaceId := Nothing;
end loop;
Filled := 0;
end Make_Empty_Table;
procedure Free_Table is
begin
Free(Table);
end Free_Table;
procedure FindVol(Key: in Index; I: out Int; V: out Rep; Found: out Boolean) is
Pos: constant PMod := Hash(Key);
begin
if Table(Pos).FaceId0=Key then
V := Zero;
Found := True;
elsif Table(Pos).FaceId=Key then
I := Table(Pos).VarsId;
V := Table(Pos).Volume;
Found := True;
else
Found := False;
end if;
end FindVol;
procedure SaveVol(Key: in Index; I: in Int; V: in Rep) is
Pos: constant PMod := Hash(Key);
begin
if V=Zero then
if Table(Pos).FaceId0=Nothing then Filled := Filled+1; end if;
Table(Pos).FaceId0 := Key;
else
if Table(Pos).FaceId=Nothing then Filled := Filled+1; end if;
Table(Pos).FaceId := Key;
Table(Pos).VarsId := I;
Table(Pos).Volume := V;
end if;
end SaveVol;
end Store;