好的,所以我尝试运行调用包 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;
但我收到以下错误。
PACKAGE sdirect IS NEW dirforinv (var_array, Gen_arr);
|
>>> expect float type in instantiation of "Real"
>>> instantiation abandoned
我不明白这一点,因为 dirforinv 需要 5 个数组,1 个 var_array 和 4 个 Gen_arr。dirforinv 的 .ads 如下。
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;
感谢您的任何建议。