Ok so I trying to run my code which calls a package dirforinv.adb:
WITH Text_IO;
WITH Ada.Numerics.Generic_Real_Arrays;
WITH Ada.Numerics.Generic_Elementary_functions;
WITH Ada.Strings.Fixed;
WITH dirforinv;
PROCEDURE levfordir IS
J : CONSTANT Integer := 100;
TYPE Real IS DIGITS 13;
PACKAGE Real_IO IS NEW Text_IO.Float_IO (Real);
PACKAGE Int_IO IS NEW Text_IO.Integer_IO (Integer);
TYPE Gen_arr IS ARRAY (INTEGER RANGE <>, INTEGER RANGE <>) OF Real;
TYPE var_array IS ARRAY (INTEGER RANGE <>) OF Real;
PACKAGE Real_arrays IS NEW Ada.numerics.Generic_Real_Arrays (Real);
USE Real_arrays;
PACKAGE sdirect IS NEW dirforinv (var_array, Gen_arr);
PACKAGE Math IS NEW Ada.numerics.Generic_Elementary_functions (Real);
USE Math;
But I get the following error.
PACKAGE sdirect IS NEW dirforinv (var_array, Gen_arr);
|
>>> expect float type in instantiation of "Real"
>>> instantiation abandoned
I don’t understand this as dirforinv expects 5 arrays, 1 of var_array and 4 of Gen_arr. The .ads for dirforinv is below.
WITH Profiles,
Profiles.Inputs,
Profiles.Conversion,
Profiles.Provide_Grids,
Profiles.Multipolar,
Profiles.Unno_Solver,
Profiles.Outputs,
Text_IO, Ada.Numerics.Generic_Elementary_Functions;
USE Profiles;
GENERIC
TYPE Real IS DIGITS <>;
TYPE Gen_arr IS ARRAY (INTEGER RANGE <>, INTEGER RANGE <>) OF REAL;
TYPE var_array IS ARRAY (INTEGER RANGE <>) OF REAL;
PACKAGE dirforinv IS
PROCEDURE direct (Variables : IN var_array;
StoI, StoQ, StoU, StoV : OUT Gen_arr );
END dirforinv;
Thanks for any advice.
The declaration of
dirforinv(horrid name, by the way) iswhich has three generic formal parameters; your attempted instantiation is
which only has two.