3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 09:34:08 +00:00

More new ML API.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2012-12-23 04:00:34 +00:00
parent 3684b3a87d
commit 371db347af
3 changed files with 807 additions and 858 deletions

View file

@ -4,7 +4,7 @@
*)
open Z3
open Z3.Context
open Z3.Arithmetic
exception ExampleException of string
@ -16,9 +16,9 @@ let _ =
Printf.printf "Running Z3 version %s\n" Version.to_string ;
let cfg = [("model", "true"); ("proof", "false")] in
let ctx = (new context cfg) in
let is = (mk_symbol_int ctx 42) in
let ss = (mk_symbol_string ctx "mySymbol") in
let bs = (mk_bool_sort ctx) in
let is = (Symbol.mk_int ctx 42) in
let ss = (Symbol.mk_string ctx "mySymbol") in
let bs = (Sort.mk_bool ctx) in
let ints = (mk_int_sort ctx) in
let rs = (mk_real_sort ctx) in
Printf.printf "int symbol: %s\n" (Symbol.to_string (is :> symbol));

View file

@ -1154,8 +1154,11 @@ def mk_ml():
for k, v in Type2Str.iteritems():
if is_obj(k):
ml_native.write('and %s = ptr\n' % v.lower())
ml_native.write('\nexternal is_null : ptr -> bool\n')
ml_native.write('\n')
ml_native.write('external is_null : ptr -> bool\n')
ml_native.write(' = "n_is_null"\n\n')
ml_native.write('external mk_null : unit -> ptr\n')
ml_native.write(' = "n_mk_null"\n\n')
ml_native.write('exception Exception of string\n\n')
# ML declarations
@ -1295,6 +1298,14 @@ def mk_ml():
ml_wrapper.write('CAMLprim value n_is_null(value p) {\n')
ml_wrapper.write(' return Val_bool(Data_custom_val(p) == 0);\n')
ml_wrapper.write('}\n\n')
ml_wrapper.write('CAMLprim value n_mk_null( void ) {\n')
ml_wrapper.write(' CAMLparam0();\n')
ml_wrapper.write(' CAMLlocal1(result);\n')
ml_wrapper.write(' void * z3_result = 0;\n')
ml_wrapper.write(' result = caml_alloc_custom(&default_custom_ops, sizeof(void*), 0, 1);\n')
ml_wrapper.write(' memcpy( Data_custom_val(result), &z3_result, sizeof(void*));\n')
ml_wrapper.write(' CAMLreturn (result);\n')
ml_wrapper.write('}\n\n')
for name, result, params in _dotnet_decls:
ip = inparams(params)
op = outparams(params)

File diff suppressed because it is too large Load diff