value caml_vc_bvWriteToMemoryArray(value vc, value arr, value bi, value e, value num) { CAMLparam5(vc,arr,bi,e,num); CAMLreturn(alloc_Expr(vc_bvWriteToMemoryArray(VC_val(vc),Expr_val(arr), Expr_val(bi),Expr_val(e), Int_val(num)))); }
// Converts expression to a string value caml_exprString(value e) { CAMLparam1(e); CAMLlocal1(r); r = caml_copy_string(exprString(Expr_val(e))); CAMLreturn(r); }
value caml_isConst(value e) { int k,r=0; CAMLparam1(e); k = getKind(Expr_val(e)); if( k == CONST ) r = 1; CAMLreturn(Val_int(r)); }
value caml_vc_orExprN(value vc, value exprs, value num) { Expr *es; int i; CAMLparam3(vc,exprs,num); CAMLlocal1(result); es = (Expr *)malloc(Int_val(num) * sizeof(Expr)); if( !es ) caml_failwith("malloc returned NULL in vc_orExprN wrapper"); for( i = 0; i < Int_val(num); i++ ) { es[i] = Expr_val(Field(exprs,i)); } result = alloc_Expr(vc_orExprN(VC_val(vc),es,Int_val(num))); free( es ); CAMLreturn(result); }
value caml_vc_impliesExpr(value vc, value h, value c) { CAMLparam3(vc,h,c); CAMLreturn(alloc_Expr(vc_impliesExpr(VC_val(vc),Expr_val(h),Expr_val(c)))); }
value caml_vc_bvConcatExpr(value vc, value l, value r) { CAMLparam3(vc,l,r); CAMLreturn(alloc_Expr(vc_bvConcatExpr(VC_val(vc),Expr_val(l),Expr_val(r)))); }
static intnat expr_hash( value a ) { return Expr_val(a)->hash(); }
value caml_vc_geExpr(value vc, value e1, value e2) { CAMLparam3(vc,e1,e2); CAMLreturn(alloc_Expr(vc_geExpr(VC_val(vc),Expr_val(e1),Expr_val(e2)))); }
value caml_vc_printExprFile(value vc, value e, value fd) { CAMLparam3(vc,e,fd); vc_printExprFile(VC_val(vc),Expr_val(e),Int_val(fd)); CAMLreturn(Val_unit); }
value caml_vc_bvBoolExtract(value vc, value e, value b) { CAMLparam3(vc,e,b); CAMLreturn(alloc_Expr(vc_bvBoolExtract(VC_val(vc),Expr_val(e),Int_val(b)))); }
value caml_vc_bvSignExtend(value vc, value e, value nb) { CAMLparam3(vc,e,nb); CAMLreturn(alloc_Expr(vc_bvSignExtend(VC_val(vc),Expr_val(e),Int_val(nb)))); }
value caml_vc_bvVar32DivByPowOfTwoExpr(value vc, value e, value rhs) { CAMLparam3(vc,e,rhs); CAMLreturn(alloc_Expr(vc_bvVar32DivByPowOfTwoExpr(VC_val(vc),Expr_val(e), Expr_val(rhs)))); }
value caml_vc_bvExtract(value vc, value e, value hi, value lo) { CAMLparam4(vc,e,hi,lo); CAMLreturn(alloc_Expr(vc_bvExtract(VC_val(vc),Expr_val(e),Int_val(hi), Int_val(lo)))); }
value caml_vc_bvVar32RightShiftExpr(value vc, value she, value e) { CAMLparam3(vc,she,e); CAMLreturn(alloc_Expr(vc_bvVar32RightShiftExpr(VC_val(vc),Expr_val(she), Expr_val(e)))); }
value caml_vc_bv32RightShiftExpr(value vc, value amt, value e) { CAMLparam3(vc,amt,e); CAMLreturn(alloc_Expr(vc_bv32RightShiftExpr(VC_val(vc),Int_val(amt), Expr_val(e)))); }
value caml_vc_bvMultExpr(value vc, value bits, value e1, value e2) { CAMLparam4(vc,bits,e1,e2); CAMLreturn(alloc_Expr(vc_bvMultExpr(VC_val(vc),Int_val(bits), Expr_val(e1),Expr_val(e2)))); }
value caml_vc_iteExpr(value vc, value i, value t, value e) { CAMLparam4(vc,i,t,e); CAMLreturn(alloc_Expr(vc_iteExpr(VC_val(vc),Expr_val(i),Expr_val(t), Expr_val(e)))); }
value caml_vc_bvReadMemoryArray(value vc, value arr, value b, value num) { CAMLparam4(vc,arr,b,num); CAMLreturn(alloc_Expr(vc_bvReadMemoryArray(VC_val(vc), Expr_val(arr), Expr_val(b), Int_val(num)))); }
// Unary minus value caml_vc_uminusExpr(value vc, value e) { CAMLparam2(vc,e); CAMLreturn(alloc_Expr(vc_uminusExpr(VC_val(vc),Expr_val(e)))); }
// Register an atomic formula of interest value caml_vc_registerAtom(value vc, value e) { CAMLparam2(vc,e); vc_registerAtom(VC_val(vc),Expr_val(e)); CAMLreturn(Val_unit); }
value caml_vc_printExpr(value vc, value e) { CAMLparam2(vc,e); vc_printExpr(VC_val(vc),Expr_val(e)); CAMLreturn(Val_unit); }
// Check validity of e in the current context value caml_vc_query(value vc, value e) { CAMLparam2(vc,e); CAMLreturn(Val_int(vc_query(VC_val(vc),Expr_val(e)))); }
// Assert a new formula in the current context value caml_vc_assertFormula(value vc, value e) { CAMLparam2(vc,e); vc_assertFormula(VC_val(vc),Expr_val(e)); CAMLreturn(Val_unit); }
value caml_getBVUnsigned(value e) { CAMLparam1(e); CAMLreturn(Val_int(getBVUnsigned(Expr_val(e)))); }
// Simplify e w.r.t. the current context value caml_vc_simplify(value vc, value e) { CAMLparam2(vc,e); CAMLreturn(alloc_Expr(vc_simplify(VC_val(vc),Expr_val(e)))); }
static value alloc_Expr(Expr e) { value v = alloc_custom(&Expr_ops, sizeof(Expr), 0, 1); Expr_val(v) = e; return v; }
static int expr_compare( value a, value b ) { return expr::compare( *Expr_val(a), *Expr_val(b) ); }
value caml_vc_deleteExpr(value e) { CAMLparam1(e); vc_deleteExpr(Expr_val(e)); CAMLreturn(Val_unit); }
static void expr_finalize( value ex ) { const expr *e = Expr_val( ex ); e->~expr(); }
// Get the type of the expr value caml_vc_getType(value vc, value e) { CAMLparam2(vc,e); CAMLreturn(alloc_Type(vc_getType(VC_val(vc),Expr_val(e)))); }