82 int callbackNesting = 0;
91 Native.Z3_push_eh push_eh;
92 Native.Z3_pop_eh pop_eh;
93 Native.Z3_fresh_eh fresh_eh;
95 Native.Z3_fixed_eh fixed_wrapper;
96 Native.Z3_final_eh final_wrapper;
97 Native.Z3_eq_eh eq_wrapper;
98 Native.Z3_eq_eh diseq_wrapper;
99 Native.Z3_decide_eh decide_wrapper;
100 Native.Z3_created_eh created_wrapper;
101 Native.Z3_on_binding_eh on_binding_wrapper;
105 this.callbackNesting++;
118 if (callbackNesting == 0)
119 this.callback = IntPtr.Zero;
127 prop.Callback(() => prop.Push(), cb);
133 prop.Callback(() => prop.Pop(num_scopes), cb);
139 var ctx =
new Context(new_context);
140 var prop1 = prop.Fresh(prop.ctx);
141 return GCHandle.ToIntPtr(prop1.gch);
147 using var term = Expr.Create(prop.ctx, _term);
148 using var value = Expr.Create(prop.ctx, _value);
149 prop.Callback(() => prop.fixed_eh(term, value), cb);
155 prop.Callback(() => prop.final_eh(), cb);
161 using var s = Expr.Create(prop.ctx, a);
162 using var t = Expr.Create(prop.ctx, b);
163 prop.Callback(() => prop.eq_eh(s, t), cb);
169 using var s = Expr.Create(prop.ctx, a);
170 using var t = Expr.Create(prop.ctx, b);
171 prop.Callback(() => prop.diseq_eh(s, t), cb);
177 using var t = Expr.Create(prop.ctx, a);
178 prop.Callback(() => prop.created_eh(t), cb);
184 using var t = Expr.Create(prop.ctx, a);
185 prop.Callback(() => prop.decide_eh(t, idx, phase), cb);
191 using var q = Expr.Create(prop.ctx, _q);
192 using var inst = Expr.Create(prop.ctx, _inst);
194 prop.Callback(() => {
195 if (prop.on_binding_wrapper !=
null)
196 result = prop.on_binding_eh(q, inst);
206 gch = GCHandle.Alloc(
this);
212 Native.Z3_solver_propagate_init(ctx.nCtx, solver.NativeObject, GCHandle.ToIntPtr(gch), push_eh, pop_eh, fresh_eh);
220 gch = GCHandle.Alloc(
this);
238 if (!gch.IsAllocated)
248 public virtual void Push() {
throw new Z3Exception(
"Push method should be overwritten"); }
253 public virtual void Pop(uint n) {
throw new Z3Exception(
"Pop method should be overwritten"); }
297 var nTerms =
Z3Object.ArrayToNative(terms.ToArray());
298 var nLHS =
Z3Object.ArrayToNative(equalities.
LHS.ToArray());
299 var nRHS =
Z3Object.ArrayToNative(equalities.
RHS.ToArray());
300 return Native.Z3_solver_propagate_consequence(ctx.nCtx,
this.callback, (uint)nTerms.Length, nTerms, (uint)equalities.
Count, nLHS, nRHS, conseq.NativeObject) != 0;
311 this.fixed_wrapper = _fixed;
312 this.fixed_eh = value;
314 Native.Z3_solver_propagate_fixed(ctx.nCtx, solver.NativeObject, fixed_wrapper);
325 this.final_wrapper = _final;
326 this.final_eh = value;
328 Native.Z3_solver_propagate_final(ctx.nCtx, solver.NativeObject, final_wrapper);
339 this.eq_wrapper = _eq;
342 Native.Z3_solver_propagate_eq(ctx.nCtx, solver.NativeObject, eq_wrapper);
353 this.diseq_wrapper = _diseq;
354 this.diseq_eh = value;
356 Native.Z3_solver_propagate_diseq(ctx.nCtx, solver.NativeObject, diseq_wrapper);
367 this.created_wrapper = _created;
368 this.created_eh = value;
370 Native.Z3_solver_propagate_created(ctx.nCtx, solver.NativeObject, created_wrapper);
381 this.decide_wrapper = _decide;
382 this.decide_eh = value;
384 Native.Z3_solver_propagate_decide(ctx.nCtx, solver.NativeObject, decide_wrapper);
395 this.on_binding_wrapper = _on_binding;
396 this.on_binding_eh = value;
398 Native.Z3_solver_propagate_on_binding(ctx.nCtx, solver.NativeObject, on_binding_wrapper);
415 return Native.Z3_solver_next_split(ctx.nCtx,
this.callback, e?.NativeObject ?? IntPtr.Zero, idx, phase) != 0;
425 if (this.callback != IntPtr.Zero)
427 Native.Z3_solver_propagate_register_cb(ctx.nCtx, callback, term.NativeObject);
431 Native.Z3_solver_propagate_register(ctx.nCtx, solver.NativeObject, term.NativeObject);
The main interaction with Z3 happens via the Context.