3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-22 16:45:31 +00:00

.NET FPA API overhaul

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2015-01-08 17:21:29 +00:00
parent bcbce8f190
commit ee2c9095c6
17 changed files with 24 additions and 68 deletions

View file

@ -227,10 +227,8 @@ namespace Microsoft.Z3
internal override void IncRef(IntPtr o)
{
// Console.WriteLine("AST IncRef()");
if (Context == null)
throw new Z3Exception("inc() called on null context");
if (o == IntPtr.Zero)
throw new Z3Exception("inc() called on null AST");
if (Context == null || o == IntPtr.Zero)
return;
Context.AST_DRQ.IncAndClear(Context, o);
base.IncRef(o);
}
@ -238,10 +236,8 @@ namespace Microsoft.Z3
internal override void DecRef(IntPtr o)
{
// Console.WriteLine("AST DecRef()");
if (Context == null)
throw new Z3Exception("dec() called on null context");
if (o == IntPtr.Zero)
throw new Z3Exception("dec() called on null AST");
if (Context == null || o == IntPtr.Zero)
return;
Context.AST_DRQ.Add(o);
base.DecRef(o);
}

View file

@ -32,11 +32,6 @@ namespace Microsoft.Z3
{
#region Internal
/// <summary> Constructor for ArithExpr </summary>
internal protected ArithExpr(Context ctx)
: base(ctx)
{
Contract.Requires(ctx != null);
}
internal ArithExpr(Context ctx, IntPtr obj)
: base(ctx, obj)
{

View file

@ -32,11 +32,6 @@ namespace Microsoft.Z3
{
#region Internal
/// <summary> Constructor for ArrayExpr </summary>
internal protected ArrayExpr(Context ctx)
: base(ctx)
{
Contract.Requires(ctx != null);
}
internal ArrayExpr(Context ctx, IntPtr obj)
: base(ctx, obj)
{

View file

@ -41,7 +41,6 @@ namespace Microsoft.Z3
#region Internal
/// <summary> Constructor for BitVecExpr </summary>
internal protected BitVecExpr(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
internal BitVecExpr(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
#endregion
}

View file

@ -32,8 +32,6 @@ namespace Microsoft.Z3
{
#region Internal
/// <summary> Constructor for BoolExpr </summary>
internal protected BoolExpr(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
/// <summary> Constructor for BoolExpr </summary>
internal BoolExpr(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
#endregion
}

View file

@ -32,11 +32,6 @@ namespace Microsoft.Z3
{
#region Internal
/// <summary> Constructor for DatatypeExpr </summary>
internal protected DatatypeExpr(Context ctx)
: base(ctx)
{
Contract.Requires(ctx != null);
}
internal DatatypeExpr(Context ctx, IntPtr obj)
: base(ctx, obj)
{

View file

@ -78,7 +78,7 @@ namespace Microsoft.Z3
#region Internal
internal EnumSort(Context ctx, Symbol name, Symbol[] enumNames)
: base(ctx)
: base(ctx, IntPtr.Zero)
{
Contract.Requires(ctx != null);
Contract.Requires(name != null);

View file

@ -1759,10 +1759,6 @@ namespace Microsoft.Z3
/// <summary>
/// Constructor for Expr
/// </summary>
internal protected Expr(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
/// <summary>
/// Constructor for Expr
/// </summary>
internal protected Expr(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
#if DEBUG

View file

@ -42,11 +42,6 @@ namespace Microsoft.Z3
#region Internal
/// <summary> Constructor for FPExpr </summary>
internal protected FPExpr(Context ctx)
: base(ctx)
{
Contract.Requires(ctx != null);
}
internal FPExpr(Context ctx, IntPtr obj)
: base(ctx, obj)
{

View file

@ -32,11 +32,6 @@ namespace Microsoft.Z3
{
#region Internal
/// <summary> Constructor for FPRMExpr </summary>
internal protected FPRMExpr(Context ctx)
: base(ctx)
{
Contract.Requires(ctx != null);
}
internal FPRMExpr(Context ctx, IntPtr obj)
: base(ctx, obj)
{

View file

@ -32,11 +32,6 @@ namespace Microsoft.Z3
{
#region Internal
/// <summary> Constructor for IntExpr </summary>
internal protected IntExpr(Context ctx)
: base(ctx)
{
Contract.Requires(ctx != null);
}
internal IntExpr(Context ctx, IntPtr obj)
: base(ctx, obj)
{

View file

@ -113,9 +113,9 @@ namespace Microsoft.Z3
}
}
#region Internal
#region Internal
internal ListSort(Context ctx, Symbol name, Sort elemSort)
: base(ctx)
: base(ctx, IntPtr.Zero)
{
Contract.Requires(ctx != null);
Contract.Requires(name != null);

View file

@ -160,7 +160,7 @@ namespace Microsoft.Z3
#region Internal
[ContractVerification(false)] // F: Clousot ForAll decompilation gets confused below. Setting verification off until I fixed the bug
internal Quantifier(Context ctx, bool isForall, Sort[] sorts, Symbol[] names, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
: base(ctx)
: base(ctx, IntPtr.Zero)
{
Contract.Requires(ctx != null);
Contract.Requires(sorts != null);
@ -203,7 +203,7 @@ namespace Microsoft.Z3
[ContractVerification(false)] // F: Clousot ForAll decompilation gets confused below. Setting verification off until I fixed the bug
internal Quantifier(Context ctx, bool isForall, Expr[] bound, Expr body, uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null, Symbol quantifierID = null, Symbol skolemID = null)
: base(ctx)
: base(ctx, IntPtr.Zero)
{
Contract.Requires(ctx != null);
Contract.Requires(body != null);

View file

@ -32,11 +32,6 @@ namespace Microsoft.Z3
{
#region Internal
/// <summary> Constructor for RealExpr </summary>
internal protected RealExpr(Context ctx)
: base(ctx)
{
Contract.Requires(ctx != null);
}
internal RealExpr(Context ctx, IntPtr obj)
: base(ctx, obj)
{

View file

@ -116,8 +116,7 @@ namespace Microsoft.Z3
#region Internal
/// <summary>
/// Sort constructor
/// </summary>
internal protected Sort(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
/// </summary>
internal Sort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
#if DEBUG
@ -146,6 +145,8 @@ namespace Microsoft.Z3
case Z3_sort_kind.Z3_UNINTERPRETED_SORT: return new UninterpretedSort(ctx, obj);
case Z3_sort_kind.Z3_FINITE_DOMAIN_SORT: return new FiniteDomainSort(ctx, obj);
case Z3_sort_kind.Z3_RELATION_SORT: return new RelationSort(ctx, obj);
case Z3_sort_kind.Z3_FLOATING_POINT_SORT: return new FPSort(ctx, obj);
case Z3_sort_kind.Z3_ROUNDING_MODE_SORT: return new FPRMSort(ctx, obj);
default:
throw new Z3Exception("Unknown sort kind");
}

View file

@ -68,7 +68,7 @@ namespace Microsoft.Z3
#region Internal
internal TupleSort(Context ctx, Symbol name, uint numFields, Symbol[] fieldNames, Sort[] fieldSorts)
: base(ctx)
: base(ctx, IntPtr.Zero)
{
Contract.Requires(ctx != null);
Contract.Requires(name != null);