mirror of
https://github.com/Z3Prover/z3
synced 2025-04-22 16:45:31 +00:00
Resolved interpolation API issues.
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
parent
1c1351a064
commit
9b8406c717
4 changed files with 49 additions and 27 deletions
|
@ -520,7 +520,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
int Z3_read_interpolation_problem(Z3_context ctx, unsigned *_num, Z3_ast cnsts[], unsigned parents[], const char *filename, Z3_string_ptr error, unsigned *ret_num_theory, Z3_ast theory[]){
|
||||
int Z3_read_interpolation_problem(Z3_context ctx, unsigned *_num, Z3_ast *cnsts[], unsigned *parents[], const char *filename, Z3_string_ptr error, unsigned *ret_num_theory, Z3_ast *theory[]){
|
||||
|
||||
hash_map<std::string, std::string> file_params;
|
||||
get_file_params(filename, file_params);
|
||||
|
@ -549,11 +549,11 @@ extern "C" {
|
|||
if (ret_num_theory)
|
||||
*ret_num_theory = num_theory;
|
||||
if (theory)
|
||||
theory = &read_theory[0];
|
||||
*theory = &read_theory[0];
|
||||
|
||||
if (!parents){
|
||||
*_num = num;
|
||||
cnsts = &read_cnsts[0];
|
||||
*cnsts = &read_cnsts[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -623,8 +623,8 @@ extern "C" {
|
|||
}
|
||||
|
||||
*_num = num;
|
||||
cnsts = &read_cnsts[0];
|
||||
parents = &read_parents[0];
|
||||
*cnsts = &read_cnsts[0];
|
||||
*parents = &read_parents[0];
|
||||
return true;
|
||||
|
||||
fail:
|
||||
|
|
|
@ -129,27 +129,21 @@ namespace Microsoft.Z3
|
|||
/// <remarks>For more information on interpolation please refer
|
||||
/// too the function Z3_read_interpolation_problem in the C/C++ API, which is
|
||||
/// well documented.</remarks>
|
||||
public int ReadInterpolationProblem(string filename, out Expr[] cnsts, ref uint[] parents, out string error, out Expr[] theory)
|
||||
public int ReadInterpolationProblem(string filename, out Expr[] cnsts, out uint[] parents, out string error, out Expr[] theory)
|
||||
{
|
||||
uint num = 0, num_theory = 0;
|
||||
IntPtr n_cnsts = new IntPtr();
|
||||
IntPtr n_theory = new IntPtr();
|
||||
IntPtr[] n_cnsts;
|
||||
IntPtr[] n_theory;
|
||||
IntPtr n_err_str;
|
||||
int r = Native.Z3_read_interpolation_problem(nCtx, ref num, ref n_cnsts, out parents, filename, out n_err_str, ref num_theory, ref n_theory);
|
||||
int r = Native.Z3_read_interpolation_problem(nCtx, ref num, out n_cnsts, out parents, filename, out n_err_str, ref num_theory, out n_theory);
|
||||
error = Marshal.PtrToStringAnsi(n_err_str);
|
||||
cnsts = new Expr[num];
|
||||
parents = new uint[num];
|
||||
theory = new Expr[num_theory];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
IntPtr ce = new IntPtr(n_cnsts.ToInt64() + (IntPtr.Size * i));
|
||||
cnsts[i] = Expr.Create(this, ce);
|
||||
}
|
||||
cnsts[i] = Expr.Create(this, n_cnsts[i]);
|
||||
for (int i = 0; i < num_theory; i++)
|
||||
{
|
||||
IntPtr te = new IntPtr(n_theory.ToInt64() + (IntPtr.Size * i));
|
||||
theory[i] = Expr.Create(this, te);
|
||||
}
|
||||
theory[i] = Expr.Create(this, n_theory[i]);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -206,18 +206,18 @@ extern "C" {
|
|||
where each value is represented using the common symbols between
|
||||
the formulas in the subtree and the remainder of the formulas.
|
||||
|
||||
def_API('Z3_read_interpolation_problem', INT, (_in(CONTEXT), _out(UINT), _out(AST), _out_array(1, UINT), _in(STRING), _out(STRING), _out(UINT), _out(AST)))
|
||||
def_API('Z3_read_interpolation_problem', INT, (_in(CONTEXT), _out(UINT), _out_managed_array(1, AST), _out_managed_array(1, UINT), _in(STRING), _out(STRING), _out(UINT), _out_managed_array(6, AST)))
|
||||
|
||||
*/
|
||||
|
||||
int Z3_API Z3_read_interpolation_problem(__in Z3_context ctx,
|
||||
__out unsigned *num,
|
||||
__out Z3_ast *cnsts,
|
||||
__out unsigned parents[],
|
||||
__out Z3_ast *cnsts[],
|
||||
__out unsigned *parents[],
|
||||
__in Z3_string filename,
|
||||
__out_opt Z3_string_ptr error,
|
||||
__out unsigned *num_theory,
|
||||
__out Z3_ast theory[]);
|
||||
__out Z3_ast *theory[]);
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue