with Large_Integers, Large_Integer_Handler_Types;
package Large_Integer_Handler is
new Large_Integers(Slice_Number => Large_Integer_Handler_Types.Slice_Value,
Arithmetic_Number => Large_Integer_Handler_Types.Slice_Arithmetic,
Slice_Index => Large_Integer_Handler_Types.Slice_Index);
package Large_Integer_Handler_Types is
Slice_Bits : constant := 15;
type Slice_Value is range 0..2**Slice_Bits - 1;
type Slice_Arithmetic is range 0..2**(2 * Slice_Bits) - 1;
type Slice_Index is range 0..10_000;
end Large_Integer_Handler_Types;
package body Large_Integers is
function Image (X : Large_Integer) return String is separate;
package body Variable_Length_Operations is separate;
end Large_Integers;
generic
type Slice_Number is range <>; -- Type for the value of a slice
type Arithmetic_Number is range <>; -- Type for calculations.
type Slice_Index is range <>; -- Type for indexing slices
package Large_Integers is
type Large_Integer (Length : Slice_Index := 0) is private;
package Variable_Length_Operations is
generic
type Int is range <>;
function Integer_To_Large_Integer (X : Int) return Large_Integer;
end Variable_Length_Operations;
private
type Number_Sign is range -1..+1;
subtype Natural_Slice_Number is Slice_Number range 0..Slice_Number'Last;
type Slice_Array is array (Slice_Index range <>) of Natural_Slice_Number;
type Large_Integer (Length : Slice_Index := 0) is
record
Sign : Number_Sign := 0;
Value : Slice_Array(0..Length) := (others => 0);
end record;
end Large_Integers;
separate (Large_Integers)
function Image (X : Large_Integer) return String is
begin
declare
function To_Large_Integer is new Variable_Length_Operations.Integer_To_Large_Integer(Natural);
use Variable_Length_Operations;
begin
return "0";
end;
end Image;