mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
override n_mk_config in ml bindings to catch exception path
This commit is contained in:
parent
29a28f544d
commit
21158d87e3
|
@ -1335,6 +1335,10 @@ z3_long_funs = frozenset([
|
||||||
'Z3_simplify_ex',
|
'Z3_simplify_ex',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
z3_ml_overrides = frozenset([
|
||||||
|
'Z3_mk_config'
|
||||||
|
])
|
||||||
|
|
||||||
def mk_z3native_stubs_c(ml_src_dir, ml_output_dir): # C interface
|
def mk_z3native_stubs_c(ml_src_dir, ml_output_dir): # C interface
|
||||||
ml_wrapperf = os.path.join(ml_output_dir, 'z3native_stubs.c')
|
ml_wrapperf = os.path.join(ml_output_dir, 'z3native_stubs.c')
|
||||||
ml_wrapper = open(ml_wrapperf, 'w')
|
ml_wrapper = open(ml_wrapperf, 'w')
|
||||||
|
@ -1346,6 +1350,10 @@ def mk_z3native_stubs_c(ml_src_dir, ml_output_dir): # C interface
|
||||||
ml_pref.close()
|
ml_pref.close()
|
||||||
|
|
||||||
for name, result, params in _dotnet_decls:
|
for name, result, params in _dotnet_decls:
|
||||||
|
|
||||||
|
if name in z3_ml_overrides:
|
||||||
|
continue
|
||||||
|
|
||||||
ip = inparams(params)
|
ip = inparams(params)
|
||||||
op = outparams(params)
|
op = outparams(params)
|
||||||
ap = arrayparams(params)
|
ap = arrayparams(params)
|
||||||
|
|
|
@ -448,3 +448,21 @@ CAMLprim value DLL_PUBLIC n_set_internal_error_handler(value ctx_v)
|
||||||
Z3_set_error_handler(ctx_p->ctx, MLErrorHandler);
|
Z3_set_error_handler(ctx_p->ctx, MLErrorHandler);
|
||||||
CAMLreturn(Val_unit);
|
CAMLreturn(Val_unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAMLprim DLL_PUBLIC value n_mk_config() {
|
||||||
|
CAMLparam0();
|
||||||
|
CAMLlocal1(result);
|
||||||
|
Z3_config z3rv;
|
||||||
|
|
||||||
|
/* invoke Z3 function */
|
||||||
|
z3rv = Z3_mk_config();
|
||||||
|
|
||||||
|
if (z3rv == NULL) {
|
||||||
|
caml_raise_with_string(*caml_named_value("Z3EXCEPTION"), "internal error");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* construct simple return value */
|
||||||
|
result = caml_alloc_custom(&default_custom_ops, sizeof(Z3_config), 0, 1); *(Z3_config*)Data_custom_val(result) = z3rv;
|
||||||
|
/* cleanup and return */
|
||||||
|
CAMLreturn(result);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue