mirror of
https://github.com/Z3Prover/z3
synced 2025-06-19 04:13:38 +00:00
checkpoint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
6fd63cd05a
commit
80b2df3621
29 changed files with 8 additions and 1329 deletions
40
src/api/z3.h
Normal file
40
src/api/z3.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*++
|
||||
Copyright (c) 2007 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
z3.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 API.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorner)
|
||||
Leonardo de Moura (leonardo) 2007-06-8
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _Z3__H_
|
||||
#define _Z3__H_
|
||||
|
||||
#include<stdio.h>
|
||||
#include"z3_macros.h"
|
||||
#include"z3_api.h"
|
||||
#include"z3_internal_types.h"
|
||||
|
||||
#undef __in
|
||||
#undef __out
|
||||
#undef __inout
|
||||
#undef __in_z
|
||||
#undef __out_z
|
||||
#undef __ecount
|
||||
#undef __in_ecount
|
||||
#undef __out_ecount
|
||||
#undef __inout_ecount
|
||||
|
||||
#endif
|
||||
|
7563
src/api/z3_api.h
Normal file
7563
src/api/z3_api.h
Normal file
File diff suppressed because it is too large
Load diff
40
src/api/z3_internal.h
Normal file
40
src/api/z3_internal.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
z3_internal.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 internal API for C and Python.
|
||||
It provides access to internal Z3 components.
|
||||
It should only be used by advanced users.
|
||||
We used it to build regression tests in Python.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2012-10-18
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _Z3_INTERNAL_H_
|
||||
#define _Z3_INTERNAL_H_
|
||||
|
||||
#include"z3_macros.h"
|
||||
#include"z3_api.h"
|
||||
#include"z3_internal_types.h"
|
||||
#include"z3_poly.h"
|
||||
|
||||
#undef __in
|
||||
#undef __out
|
||||
#undef __inout
|
||||
#undef __in_z
|
||||
#undef __out_z
|
||||
#undef __ecount
|
||||
#undef __in_ecount
|
||||
#undef __out_ecount
|
||||
#undef __inout_ecount
|
||||
|
||||
#endif
|
34
src/api/z3_internal_types.h
Normal file
34
src/api/z3_internal_types.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
z3_internal_types.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 internal API type declarations.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2012-10-18
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _Z3_INTERNAL_TYPES_H_
|
||||
#define _Z3_INTERNAL_TYPES_H_
|
||||
|
||||
DEFINE_TYPE(Z3_polynomial_manager);
|
||||
DEFINE_TYPE(Z3_polynomial);
|
||||
DEFINE_TYPE(Z3_monomial);
|
||||
|
||||
/*
|
||||
Definitions for update_api.py
|
||||
|
||||
def_Type('POLYNOMIAL_MANAGER', 'Z3_polynomial_manager', 'PolynomialManagerObj')
|
||||
def_Type('POLYNOMIAL', 'Z3_polynomial', 'PolynomialObj')
|
||||
def_Type('MONOMIAL', 'Z3_monomial', 'MonomialObj')
|
||||
*/
|
||||
|
||||
#endif
|
70
src/api/z3_logger.h
Normal file
70
src/api/z3_logger.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
z3_logger.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Goodies for log generation
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-09-22
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#include<iostream>
|
||||
#include"symbol.h"
|
||||
struct ll_escaped { char const * m_str; ll_escaped(char const * str):m_str(str) {} };
|
||||
static std::ostream & operator<<(std::ostream & out, ll_escaped const & d) {
|
||||
char const * s = d.m_str;
|
||||
while (*s) {
|
||||
char c = *s;
|
||||
if (('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') ||
|
||||
c == '~' || c == '!' || c == '@' || c == '#' || c == '$' || c == '%' || c == '^' || c == '&' ||
|
||||
c == '*' || c == '-' || c == '_' || c == '+' || c == '.' || c == '?' || c == '/' || c == ' ' ||
|
||||
c == '<' || c == '>') {
|
||||
out << c;
|
||||
}
|
||||
else {
|
||||
char str[4] = {'0', '0', '0', 0};
|
||||
str[2] = '0' + (c % 10);
|
||||
c /= 10;
|
||||
str[1] = '0' + (c % 10);
|
||||
c /= 10;
|
||||
str[0] = '0' + c;
|
||||
out << '\\' << str;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static void R() { *g_z3_log << "R\n"; g_z3_log->flush(); }
|
||||
static void P(void * obj) { *g_z3_log << "P " << obj << "\n"; g_z3_log->flush(); }
|
||||
static void I(__int64 i) { *g_z3_log << "I " << i << "\n"; g_z3_log->flush(); }
|
||||
static void U(__uint64 u) { *g_z3_log << "U " << u << "\n"; g_z3_log->flush(); }
|
||||
static void D(double d) { *g_z3_log << "D " << d << "\n"; g_z3_log->flush(); }
|
||||
static void S(Z3_string str) { *g_z3_log << "S \"" << ll_escaped(str) << "\"\n"; g_z3_log->flush(); }
|
||||
static void Sy(Z3_symbol sym) {
|
||||
symbol s = symbol::mk_symbol_from_c_ptr(reinterpret_cast<void *>(sym));
|
||||
if (s == symbol::null) {
|
||||
*g_z3_log << "N\n";
|
||||
}
|
||||
else if (s.is_numerical()) {
|
||||
*g_z3_log << "# " << s.get_num() << "\n";
|
||||
}
|
||||
else {
|
||||
*g_z3_log << "$ |" << ll_escaped(s.bare_str()) << "|\n";
|
||||
}
|
||||
g_z3_log->flush();
|
||||
}
|
||||
static void Ap(unsigned sz) { *g_z3_log << "p " << sz << "\n"; g_z3_log->flush(); }
|
||||
static void Au(unsigned sz) { *g_z3_log << "u " << sz << "\n"; g_z3_log->flush(); }
|
||||
static void Asy(unsigned sz) { *g_z3_log << "s " << sz << "\n"; g_z3_log->flush(); }
|
||||
static void C(unsigned id) { *g_z3_log << "C " << id << "\n"; g_z3_log->flush(); }
|
||||
void _Z3_append_log(char const * msg) { *g_z3_log << "M \"" << ll_escaped(msg) << "\"\n"; g_z3_log->flush(); }
|
||||
|
54
src/api/z3_macros.h
Normal file
54
src/api/z3_macros.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
#ifndef __in
|
||||
#define __in
|
||||
#endif
|
||||
|
||||
#ifndef __out
|
||||
#define __out
|
||||
#endif
|
||||
|
||||
#ifndef __out_opt
|
||||
#define __out_opt __out
|
||||
#endif
|
||||
|
||||
#ifndef __ecount
|
||||
#define __ecount(num_args)
|
||||
#endif
|
||||
|
||||
#ifndef __in_ecount
|
||||
#define __in_ecount(num_args) __in __ecount(num_args)
|
||||
#endif
|
||||
|
||||
#ifndef __out_ecount
|
||||
#define __out_ecount(num_args) __out __ecount(num_args)
|
||||
#endif
|
||||
|
||||
#ifndef __inout_ecount
|
||||
#define __inout_ecount(num_args) __in __out __ecount(num_args)
|
||||
#endif
|
||||
|
||||
#ifndef __inout
|
||||
#define __inout __in __out
|
||||
#endif
|
||||
|
||||
#ifndef Z3_bool_opt
|
||||
#define Z3_bool_opt Z3_bool
|
||||
#endif
|
||||
|
||||
#ifndef Z3_API
|
||||
#define Z3_API
|
||||
#endif
|
||||
|
||||
#ifndef DEFINE_TYPE
|
||||
#define DEFINE_TYPE(T) typedef struct _ ## T *T
|
||||
#endif
|
||||
|
||||
#ifndef DEFINE_VOID
|
||||
#define DEFINE_VOID(T) typedef void* T
|
||||
#endif
|
||||
|
||||
#ifndef BEGIN_MLAPI_EXCLUDE
|
||||
#define BEGIN_MLAPI_EXCLUDE
|
||||
#endif
|
||||
#ifndef END_MLAPI_EXCLUDE
|
||||
#define END_MLAPI_EXCLUDE
|
||||
#endif
|
72
src/api/z3_poly.h
Normal file
72
src/api/z3_poly.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
z3_poly.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 multivariate polynomial API.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2012-10-18
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _Z3_POLY_H_
|
||||
#define _Z3_POLY_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
\brief Create a new polynomial manager.
|
||||
|
||||
def_API('Z3_mk_polynomial_manager', POLYNOMIAL_MANAGER, (_in(CONTEXT),))
|
||||
*/
|
||||
Z3_polynomial_manager Z3_API Z3_mk_polynomial_manager(__in Z3_context c);
|
||||
|
||||
/**
|
||||
\brief Delete the given polynomial manager.
|
||||
|
||||
def_API('Z3_del_polynomial_manager', VOID, (_in(CONTEXT), _in(POLYNOMIAL_MANAGER)))
|
||||
*/
|
||||
void Z3_API Z3_del_polynomial_manager(__in Z3_context c, __in Z3_polynomial_manager m);
|
||||
|
||||
/**
|
||||
\brief Return the zero polynomial.
|
||||
|
||||
def_API('Z3_mk_zero_polynomial', POLYNOMIAL, (_in(CONTEXT), _in(POLYNOMIAL_MANAGER)))
|
||||
*/
|
||||
Z3_polynomial Z3_API Z3_mk_zero_polynomial(__in Z3_context c, __in Z3_polynomial_manager m);
|
||||
|
||||
/**
|
||||
\brief Increment p's reference counter
|
||||
|
||||
def_API('Z3_polynomial_inc_ref', VOID, (_in(CONTEXT), _in(POLYNOMIAL_MANAGER), _in(POLYNOMIAL)))
|
||||
*/
|
||||
void Z3_API Z3_polynomial_inc_ref(__in Z3_context c, __in Z3_polynomial_manager m, __in Z3_polynomial p);
|
||||
|
||||
/**
|
||||
\brief Decrement p's reference counter.
|
||||
|
||||
def_API('Z3_polynomial_dec_ref', VOID, (_in(CONTEXT), _in(POLYNOMIAL_MANAGER), _in(POLYNOMIAL)))
|
||||
*/
|
||||
void Z3_API Z3_polynomial_dec_ref(__in Z3_context c, __in Z3_polynomial_manager m, __in Z3_polynomial p);
|
||||
|
||||
/**
|
||||
\brief Convert the given polynomial into a string.
|
||||
|
||||
def_API('Z3_polynomial_to_string', STRING, (_in(CONTEXT), _in(POLYNOMIAL_MANAGER), _in(POLYNOMIAL)))
|
||||
*/
|
||||
Z3_string Z3_API Z3_polynomial_to_string(__in Z3_context c, __in Z3_polynomial_manager m, __in Z3_polynomial p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
80
src/api/z3_private.h
Normal file
80
src/api/z3_private.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*++
|
||||
Copyright (c) 2007 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
z3_private.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 API.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorner)
|
||||
Leonardo de Moura (leonardo) 2007-06-8
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
#include<iostream>
|
||||
#include"rational.h"
|
||||
#include"z3_macros.h"
|
||||
|
||||
#ifndef _Z3_PRIVATE__H_
|
||||
#define _Z3_PRIVATE__H_
|
||||
|
||||
|
||||
#ifndef CAMLIDL
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
#else
|
||||
[pointer_default(ref)] interface Z3 {
|
||||
#endif // CAMLIDL
|
||||
|
||||
Z3_bool Z3_API Z3_get_numeral_rational(__in Z3_context c, __in Z3_ast a, rational& r);
|
||||
|
||||
/**
|
||||
\brief \mlh exec_smtlib2_string c str \endmlh
|
||||
Parse the given string using the SMT-LIB2 parser and execute its commands.
|
||||
|
||||
It returns a formula comprising of the conjunction of assertions in the scope
|
||||
(up to push/pop) at the end of the string.
|
||||
The returned formula is also asserted to the logical context on return.
|
||||
*/
|
||||
Z3_ast Z3_API Z3_exec_smtlib2_string(__in Z3_context c,
|
||||
__in Z3_string str,
|
||||
__in unsigned num_sorts,
|
||||
__in_ecount(num_sorts) Z3_symbol sort_names[],
|
||||
__in_ecount(num_sorts) Z3_sort sorts[],
|
||||
__in unsigned num_decls,
|
||||
__in_ecount(num_decls) Z3_symbol decl_names[],
|
||||
__in_ecount(num_decls) Z3_func_decl decls[]
|
||||
);
|
||||
|
||||
/**
|
||||
\brief Similar to #Z3_exec_smtlib2_string, but reads the commands from a file.
|
||||
*/
|
||||
Z3_ast Z3_API Z3_exec_smtlib2_file(__in Z3_context c,
|
||||
__in Z3_string file_name,
|
||||
__in unsigned num_sorts,
|
||||
__in_ecount(num_sorts) Z3_symbol sort_names[],
|
||||
__in_ecount(num_sorts) Z3_sort sorts[],
|
||||
__in unsigned num_decls,
|
||||
__in_ecount(num_decls) Z3_symbol decl_names[],
|
||||
__in_ecount(num_decls) Z3_func_decl decls[]
|
||||
);
|
||||
|
||||
|
||||
#ifndef CAMLIDL
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // __cplusplus
|
||||
#else
|
||||
}
|
||||
#endif // CAMLIDL
|
||||
|
||||
#endif
|
||||
|
711
src/api/z3_replayer.cpp
Normal file
711
src/api/z3_replayer.cpp
Normal file
|
@ -0,0 +1,711 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
z3_replayer.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Interpreter for Z3 logs
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-09-22
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#include"vector.h"
|
||||
#include"map.h"
|
||||
#include"z3_replayer.h"
|
||||
#include"stream_buffer.h"
|
||||
#include"symbol.h"
|
||||
#include"trace.h"
|
||||
|
||||
void register_z3_replayer_cmds(z3_replayer & in);
|
||||
|
||||
void throw_invalid_reference() {
|
||||
throw z3_replayer_exception("invalid argument reference");
|
||||
}
|
||||
|
||||
struct z3_replayer::imp {
|
||||
z3_replayer & m_owner;
|
||||
std::istream & m_stream;
|
||||
char m_curr; // current char;
|
||||
int m_line; // line
|
||||
svector<char> m_string;
|
||||
symbol m_id;
|
||||
__int64 m_int64;
|
||||
__uint64 m_uint64;
|
||||
double m_double;
|
||||
size_t m_ptr;
|
||||
size_t_map<void *> m_heap;
|
||||
svector<z3_replayer_cmd> m_cmds;
|
||||
|
||||
enum value_kind { INT64, UINT64, DOUBLE, STRING, SYMBOL, OBJECT, UINT_ARRAY, SYMBOL_ARRAY, OBJECT_ARRAY };
|
||||
|
||||
struct value {
|
||||
value_kind m_kind;
|
||||
union {
|
||||
__int64 m_int;
|
||||
__uint64 m_uint;
|
||||
double m_double;
|
||||
char const * m_str;
|
||||
void * m_obj;
|
||||
};
|
||||
value():m_kind(OBJECT), m_int(0) {}
|
||||
value(void * obj):m_kind(OBJECT), m_obj(obj) {}
|
||||
value(value_kind k, char const * str):m_kind(k), m_str(str) {}
|
||||
value(value_kind k, __uint64 u):m_kind(k), m_uint(u) {}
|
||||
value(value_kind k, __int64 i):m_kind(k), m_int(i) {}
|
||||
value(value_kind k, double d):m_kind(k), m_double(d) {}
|
||||
};
|
||||
|
||||
svector<value> m_args;
|
||||
void * m_result;
|
||||
vector<ptr_vector<void> > m_obj_arrays;
|
||||
vector<svector<Z3_symbol> > m_sym_arrays;
|
||||
vector<unsigned_vector> m_unsigned_arrays;
|
||||
|
||||
imp(z3_replayer & o, std::istream & in):
|
||||
m_owner(o),
|
||||
m_stream(in),
|
||||
m_curr(0),
|
||||
m_line(1) {
|
||||
next();
|
||||
}
|
||||
|
||||
void display_arg(std::ostream & out, value const & v) const {
|
||||
switch (v.m_kind) {
|
||||
case INT64:
|
||||
out << v.m_int;
|
||||
break;
|
||||
case UINT64:
|
||||
out << v.m_uint;
|
||||
break;
|
||||
case DOUBLE:
|
||||
out << v.m_double;
|
||||
break;
|
||||
case STRING:
|
||||
out << v.m_str;
|
||||
break;
|
||||
case SYMBOL:
|
||||
out << symbol::mk_symbol_from_c_ptr(v.m_str);
|
||||
break;
|
||||
case OBJECT:
|
||||
out << v.m_obj;
|
||||
break;
|
||||
case UINT_ARRAY:
|
||||
case OBJECT_ARRAY:
|
||||
case SYMBOL_ARRAY:
|
||||
out << "<array>";
|
||||
break;
|
||||
default:
|
||||
out << "<unknown>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void display_args(std::ostream & out) const {
|
||||
for (unsigned i = 0; i < m_args.size(); i++) {
|
||||
if (i > 0) out << " ";
|
||||
display_arg(out, m_args[i]);
|
||||
}
|
||||
}
|
||||
|
||||
char curr() const { return m_curr; }
|
||||
void new_line() { m_line++; }
|
||||
void next() { m_curr = m_stream.get(); }
|
||||
|
||||
void read_string_core(char delimiter) {
|
||||
if (curr() != delimiter)
|
||||
throw z3_replayer_exception("invalid string/symbol");
|
||||
m_string.reset();
|
||||
next();
|
||||
while (true) {
|
||||
char c = curr();
|
||||
if (c == EOF) {
|
||||
throw z3_replayer_exception("unexpected end of file");
|
||||
}
|
||||
else if (c == '\n') {
|
||||
throw z3_replayer_exception("unexpected end of line");
|
||||
}
|
||||
else if (c == '\\') {
|
||||
next();
|
||||
unsigned val = 0;
|
||||
unsigned sz = 0;
|
||||
while (sz < 3) {
|
||||
c = curr();
|
||||
if ('0' <= c && c <= '9') {
|
||||
val *= 10;
|
||||
val += c - '0';
|
||||
sz++;
|
||||
}
|
||||
else {
|
||||
throw z3_replayer_exception("invalid scaped character");
|
||||
}
|
||||
if (val > 255)
|
||||
throw z3_replayer_exception("invalid scaped character");
|
||||
next();
|
||||
}
|
||||
TRACE("z3_replayer_escape", tout << "val: " << val << "\n";);
|
||||
m_string.push_back(static_cast<char>(val));
|
||||
}
|
||||
else if (c == delimiter) {
|
||||
next();
|
||||
m_string.push_back(0);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
m_string.push_back(c);
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void read_string() {
|
||||
read_string_core('"');
|
||||
}
|
||||
|
||||
void read_quoted_symbol() {
|
||||
read_string_core('|');
|
||||
m_id = m_string.begin();
|
||||
}
|
||||
|
||||
void read_int64() {
|
||||
if (!(curr() == '-' || ('0' <= curr() && curr() <= '9')))
|
||||
throw z3_replayer_exception("invalid integer");
|
||||
bool sign = false;
|
||||
if (curr() == '-') {
|
||||
sign = true;
|
||||
next();
|
||||
if (!('0' <= curr() && curr() <= '9'))
|
||||
throw z3_replayer_exception("invalid integer");
|
||||
}
|
||||
m_int64 = 0;
|
||||
while (true) {
|
||||
char c = curr();
|
||||
if ('0' <= c && c <= '9') {
|
||||
m_int64 = 10*m_int64 + (c - '0');
|
||||
next();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sign)
|
||||
m_int64 = -m_int64;
|
||||
}
|
||||
|
||||
void read_uint64() {
|
||||
if (!('0' <= curr() && curr() <= '9'))
|
||||
throw z3_replayer_exception("invalid unsigned");
|
||||
m_uint64 = 0;
|
||||
while (true) {
|
||||
char c = curr();
|
||||
if ('0' <= c && c <= '9') {
|
||||
m_uint64 = 10*m_uint64 + (c - '0');
|
||||
next();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool is_double_char() const {
|
||||
return curr() == '-' || curr() == '.' || ('0' <= curr() && curr() <= '9') || curr() == 'e' || curr() == 'E';
|
||||
}
|
||||
|
||||
void read_double() {
|
||||
m_string.reset();
|
||||
while (is_double_char()) {
|
||||
m_string.push_back(curr());
|
||||
next();
|
||||
}
|
||||
if (m_string.empty())
|
||||
throw z3_replayer_exception("invalid double");
|
||||
m_string.push_back(0);
|
||||
char * ptr;
|
||||
m_double = strtod(m_string.begin(), &ptr);
|
||||
}
|
||||
|
||||
void read_ptr() {
|
||||
if (!(('0' <= curr() && curr() <= '9') || ('A' <= curr() && curr() <= 'F') || ('a' <= curr() && curr() <= 'f')))
|
||||
throw z3_replayer_exception("invalid ptr");
|
||||
m_ptr = 0;
|
||||
while (true) {
|
||||
char c = curr();
|
||||
if ('0' <= c && c <= '9') {
|
||||
m_ptr = m_ptr * 16 + (c - '0');
|
||||
}
|
||||
else if ('a' <= c && c <= 'f') {
|
||||
m_ptr = m_ptr * 16 + 10 + (c - 'a');
|
||||
}
|
||||
else if ('A' <= c && c <= 'F') {
|
||||
m_ptr = m_ptr * 16 + 10 + (c - 'A');
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
void skip_blank() {
|
||||
while (true) {
|
||||
char c = curr();
|
||||
if (c == '\n') {
|
||||
new_line();
|
||||
next();
|
||||
}
|
||||
else if (c == ' ' || c == '\t') {
|
||||
next();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void push_array(unsigned sz, value_kind k) {
|
||||
unsigned asz = m_args.size();
|
||||
if (sz > asz)
|
||||
throw z3_replayer_exception("invalid array size");
|
||||
__uint64 aidx;
|
||||
value_kind nk;
|
||||
for (unsigned i = asz - sz; i < asz; i++) {
|
||||
if (m_args[i].m_kind != k)
|
||||
throw z3_replayer_exception("invalid array: mixed value types");
|
||||
}
|
||||
if (k == UINT64) {
|
||||
aidx = m_unsigned_arrays.size();
|
||||
nk = UINT_ARRAY;
|
||||
m_unsigned_arrays.push_back(unsigned_vector());
|
||||
unsigned_vector & v = m_unsigned_arrays.back();
|
||||
for (unsigned i = asz - sz; i < asz; i++) {
|
||||
v.push_back(static_cast<unsigned>(m_args[i].m_uint));
|
||||
}
|
||||
}
|
||||
else if (k == SYMBOL) {
|
||||
aidx = m_sym_arrays.size();
|
||||
nk = SYMBOL_ARRAY;
|
||||
m_sym_arrays.push_back(svector<Z3_symbol>());
|
||||
svector<Z3_symbol> & v = m_sym_arrays.back();
|
||||
for (unsigned i = asz - sz; i < asz; i++) {
|
||||
v.push_back(reinterpret_cast<Z3_symbol>(const_cast<char*>(m_args[i].m_str)));
|
||||
}
|
||||
}
|
||||
else if (k == OBJECT) {
|
||||
TRACE("z3_replayer_bug",
|
||||
tout << "args: "; display_args(tout); tout << "\n";
|
||||
tout << "push_back, sz: " << sz << ", m_obj_arrays.size(): " << m_obj_arrays.size() << "\n";
|
||||
for (unsigned i = asz - sz; i < asz; i++) {
|
||||
tout << "pushing: " << m_args[i].m_obj << "\n";
|
||||
});
|
||||
aidx = m_obj_arrays.size();
|
||||
nk = OBJECT_ARRAY;
|
||||
m_obj_arrays.push_back(ptr_vector<void>());
|
||||
ptr_vector<void> & v = m_obj_arrays.back();
|
||||
for (unsigned i = asz - sz; i < asz; i++) {
|
||||
v.push_back(m_args[i].m_obj);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw z3_replayer_exception("unsupported array type");
|
||||
}
|
||||
m_args.shrink(asz - sz);
|
||||
m_args.push_back(value(nk, aidx));
|
||||
}
|
||||
|
||||
#define TICK_FREQUENCY 100000
|
||||
|
||||
void parse() {
|
||||
unsigned long long counter = 0;
|
||||
unsigned tick = 0;
|
||||
while (true) {
|
||||
IF_VERBOSE(1, {
|
||||
counter++; tick++;
|
||||
if (tick >= TICK_FREQUENCY) {
|
||||
std::cout << "[replayer] " << counter << " operations executed" << std::endl;
|
||||
tick = 0;
|
||||
}
|
||||
});
|
||||
skip_blank();
|
||||
char c = curr();
|
||||
if (c == EOF)
|
||||
return;
|
||||
switch (c) {
|
||||
case 'R':
|
||||
// reset
|
||||
next();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "R\n";);
|
||||
reset();
|
||||
break;
|
||||
case 'P': {
|
||||
// push pointer
|
||||
next(); skip_blank(); read_ptr();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "P " << m_ptr << "\n";);
|
||||
if (m_ptr == 0) {
|
||||
m_args.push_back(0);
|
||||
}
|
||||
else {
|
||||
void * obj = 0;
|
||||
if (!m_heap.find(m_ptr, obj))
|
||||
throw z3_replayer_exception("invalid pointer");
|
||||
m_args.push_back(value(obj));
|
||||
TRACE("z3_replayer_bug", tout << "args after 'P':\n"; display_args(tout); tout << "\n";);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'S': {
|
||||
// push string
|
||||
next(); skip_blank(); read_string();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "S " << m_string.begin() << "\n";);
|
||||
symbol sym(m_string.begin()); // save string
|
||||
m_args.push_back(value(STRING, sym.bare_str()));
|
||||
break;
|
||||
}
|
||||
case 'N':
|
||||
// push null symbol
|
||||
next();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "N\n";);
|
||||
m_args.push_back(value(SYMBOL, static_cast<char const *>(0)));
|
||||
break;
|
||||
case '$': {
|
||||
// push symbol
|
||||
next(); skip_blank(); read_quoted_symbol();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "$ " << m_id << "\n";);
|
||||
m_args.push_back(value(SYMBOL, m_id.bare_str()));
|
||||
break;
|
||||
}
|
||||
case '#': {
|
||||
// push numeral symbol
|
||||
next(); skip_blank(); read_uint64();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "# " << m_uint64 << "\n";);
|
||||
symbol sym(static_cast<unsigned>(m_uint64));
|
||||
m_args.push_back(value(SYMBOL, static_cast<char const *>(sym.c_ptr())));
|
||||
break;
|
||||
}
|
||||
case 'I':
|
||||
// push integer;
|
||||
next(); skip_blank(); read_int64();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "I " << m_int64 << "\n";);
|
||||
m_args.push_back(value(INT64, m_int64));
|
||||
break;
|
||||
case 'U':
|
||||
// push unsigned;
|
||||
next(); skip_blank(); read_uint64();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "U " << m_uint64 << "\n";);
|
||||
m_args.push_back(value(UINT64, m_uint64));
|
||||
break;
|
||||
case 'D':
|
||||
// push double
|
||||
next(); skip_blank(); read_double();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "D " << m_double << "\n";);
|
||||
m_args.push_back(value(DOUBLE, m_double));
|
||||
break;
|
||||
case 'p':
|
||||
case 's':
|
||||
case 'u':
|
||||
// push array
|
||||
next(); skip_blank(); read_uint64();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "A " << m_uint64 << "\n";);
|
||||
if (c == 'p')
|
||||
push_array(static_cast<unsigned>(m_uint64), OBJECT);
|
||||
else if (c == 's')
|
||||
push_array(static_cast<unsigned>(m_uint64), SYMBOL);
|
||||
else
|
||||
push_array(static_cast<unsigned>(m_uint64), UINT64);
|
||||
break;
|
||||
case 'C': {
|
||||
// call procedure
|
||||
next(); skip_blank(); read_uint64();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "C " << m_uint64 << "\n";);
|
||||
unsigned idx = static_cast<unsigned>(m_uint64);
|
||||
if (idx >= m_cmds.size())
|
||||
throw z3_replayer_exception("invalid command");
|
||||
try {
|
||||
m_cmds[idx](m_owner);
|
||||
}
|
||||
catch (z3_error & ex) {
|
||||
throw ex;
|
||||
}
|
||||
catch (z3_exception & ex) {
|
||||
std::cout << "[z3 exception]: " << ex.msg() << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '=':
|
||||
// save result
|
||||
// = obj_id
|
||||
next(); skip_blank(); read_ptr();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "= " << m_ptr << "\n";);
|
||||
m_heap.insert(m_ptr, m_result);
|
||||
break;
|
||||
case '*': {
|
||||
// save out
|
||||
// @ obj_id pos
|
||||
next(); skip_blank(); read_ptr(); skip_blank(); read_uint64();
|
||||
unsigned pos = static_cast<unsigned>(m_uint64);
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "* " << m_ptr << " " << pos << "\n";);
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != OBJECT)
|
||||
throw_invalid_reference();
|
||||
m_heap.insert(m_ptr, m_args[pos].m_obj);
|
||||
break;
|
||||
}
|
||||
case '@': {
|
||||
// save array out
|
||||
// @ obj_id array_pos idx
|
||||
next(); skip_blank(); read_ptr(); skip_blank(); read_uint64();
|
||||
unsigned pos = static_cast<unsigned>(m_uint64);
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != OBJECT_ARRAY)
|
||||
throw_invalid_reference();
|
||||
unsigned aidx = static_cast<unsigned>(m_args[pos].m_uint);
|
||||
ptr_vector<void> & v = m_obj_arrays[aidx];
|
||||
skip_blank(); read_uint64();
|
||||
unsigned idx = static_cast<unsigned>(m_uint64);
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "@ " << m_ptr << " " << pos << " " << idx << "\n";);
|
||||
TRACE("z3_replayer_bug", tout << "v[idx]: " << v[idx] << "\n";);
|
||||
m_heap.insert(m_ptr, v[idx]);
|
||||
break;
|
||||
}
|
||||
case 'M':
|
||||
// user message
|
||||
next(); skip_blank(); read_string();
|
||||
TRACE("z3_replayer", tout << "[" << m_line << "] " << "M " << m_string.begin() << "\n";);
|
||||
std::cout << m_string.begin() << "\n"; std::cout.flush();
|
||||
break;
|
||||
default:
|
||||
TRACE("z3_replayer", tout << "unknown command " << c << "\n";);
|
||||
throw z3_replayer_exception("unknown log command");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int get_int(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != INT64)
|
||||
throw_invalid_reference();
|
||||
return static_cast<int>(m_args[pos].m_int);
|
||||
}
|
||||
|
||||
__int64 get_int64(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != INT64)
|
||||
throw_invalid_reference();
|
||||
return m_args[pos].m_int;
|
||||
}
|
||||
|
||||
unsigned get_uint(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != UINT64)
|
||||
throw_invalid_reference();
|
||||
return static_cast<unsigned>(m_args[pos].m_uint);
|
||||
}
|
||||
|
||||
__uint64 get_uint64(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != UINT64)
|
||||
throw_invalid_reference();
|
||||
return m_args[pos].m_uint;
|
||||
}
|
||||
|
||||
double get_double(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != DOUBLE)
|
||||
throw_invalid_reference();
|
||||
return m_args[pos].m_double;
|
||||
}
|
||||
|
||||
Z3_string get_str(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != STRING)
|
||||
throw_invalid_reference();
|
||||
return m_args[pos].m_str;
|
||||
}
|
||||
|
||||
Z3_symbol get_symbol(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != SYMBOL)
|
||||
throw_invalid_reference();
|
||||
return reinterpret_cast<Z3_symbol>(const_cast<char*>(m_args[pos].m_str));
|
||||
}
|
||||
|
||||
void * get_obj(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != OBJECT)
|
||||
throw_invalid_reference();
|
||||
return m_args[pos].m_obj;
|
||||
}
|
||||
|
||||
unsigned * get_uint_array(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != UINT_ARRAY)
|
||||
throw_invalid_reference();
|
||||
unsigned idx = static_cast<unsigned>(m_args[pos].m_uint);
|
||||
return m_unsigned_arrays[idx].c_ptr();
|
||||
}
|
||||
|
||||
Z3_symbol * get_symbol_array(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != SYMBOL_ARRAY)
|
||||
throw_invalid_reference();
|
||||
unsigned idx = static_cast<unsigned>(m_args[pos].m_uint);
|
||||
return m_sym_arrays[idx].c_ptr();
|
||||
}
|
||||
|
||||
void ** get_obj_array(unsigned pos) const {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != OBJECT_ARRAY)
|
||||
throw_invalid_reference();
|
||||
unsigned idx = static_cast<unsigned>(m_args[pos].m_uint);
|
||||
ptr_vector<void> const & v = m_obj_arrays[idx];
|
||||
TRACE("z3_replayer_bug", tout << "pos: " << pos << ", idx: " << idx << " size(): " << v.size() << "\n";
|
||||
for (unsigned i = 0; i < v.size(); i++) tout << v[i] << " "; tout << "\n";);
|
||||
return v.c_ptr();
|
||||
}
|
||||
|
||||
int * get_int_addr(unsigned pos) {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != INT64)
|
||||
throw_invalid_reference();
|
||||
return reinterpret_cast<int*>(&(m_args[pos].m_int));
|
||||
}
|
||||
|
||||
__int64 * get_int64_addr(unsigned pos) {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != INT64)
|
||||
throw_invalid_reference();
|
||||
return &(m_args[pos].m_int);
|
||||
}
|
||||
|
||||
unsigned * get_uint_addr(unsigned pos) {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != UINT64)
|
||||
throw_invalid_reference();
|
||||
return reinterpret_cast<unsigned*>(&(m_args[pos].m_uint));
|
||||
}
|
||||
|
||||
__uint64 * get_uint64_addr(unsigned pos) {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != UINT64)
|
||||
throw_invalid_reference();
|
||||
return &(m_args[pos].m_uint);
|
||||
}
|
||||
|
||||
Z3_string * get_str_addr(unsigned pos) {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != STRING)
|
||||
throw_invalid_reference();
|
||||
return &(m_args[pos].m_str);
|
||||
}
|
||||
|
||||
void ** get_obj_addr(unsigned pos) {
|
||||
if (pos >= m_args.size() || m_args[pos].m_kind != OBJECT)
|
||||
throw_invalid_reference();
|
||||
return &(m_args[pos].m_obj);
|
||||
}
|
||||
|
||||
void store_result(void * obj) {
|
||||
m_result = obj;
|
||||
}
|
||||
|
||||
void register_cmd(unsigned id, z3_replayer_cmd cmd) {
|
||||
m_cmds.reserve(id+1, 0);
|
||||
m_cmds[id] = cmd;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
m_result = 0;
|
||||
m_args.reset();
|
||||
m_obj_arrays.reset();
|
||||
m_sym_arrays.reset();
|
||||
m_unsigned_arrays.reset();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
z3_replayer::z3_replayer(std::istream & in) {
|
||||
m_imp = alloc(imp, *this, in);
|
||||
register_z3_replayer_cmds(*this);
|
||||
}
|
||||
|
||||
z3_replayer::~z3_replayer() {
|
||||
dealloc(m_imp);
|
||||
}
|
||||
|
||||
unsigned z3_replayer::get_line() const {
|
||||
return m_imp->m_line;
|
||||
}
|
||||
|
||||
bool z3_replayer::get_bool(unsigned pos) const {
|
||||
return get_int(pos) != 0;
|
||||
}
|
||||
|
||||
int z3_replayer::get_int(unsigned pos) const {
|
||||
return m_imp->get_int(pos);
|
||||
}
|
||||
|
||||
unsigned z3_replayer::get_uint(unsigned pos) const {
|
||||
return m_imp->get_uint(pos);
|
||||
}
|
||||
|
||||
__int64 z3_replayer::get_int64(unsigned pos) const {
|
||||
return m_imp->get_int64(pos);
|
||||
}
|
||||
|
||||
__uint64 z3_replayer::get_uint64(unsigned pos) const {
|
||||
return m_imp->get_uint64(pos);
|
||||
}
|
||||
|
||||
double z3_replayer::get_double(unsigned pos) const {
|
||||
return m_imp->get_double(pos);
|
||||
}
|
||||
|
||||
Z3_string z3_replayer::get_str(unsigned pos) const {
|
||||
return m_imp->get_str(pos);
|
||||
}
|
||||
|
||||
Z3_symbol z3_replayer::get_symbol(unsigned pos) const {
|
||||
return m_imp->get_symbol(pos);
|
||||
}
|
||||
|
||||
void * z3_replayer::get_obj(unsigned pos) const {
|
||||
return m_imp->get_obj(pos);
|
||||
}
|
||||
|
||||
unsigned * z3_replayer::get_uint_array(unsigned pos) const {
|
||||
return m_imp->get_uint_array(pos);
|
||||
}
|
||||
|
||||
Z3_symbol * z3_replayer::get_symbol_array(unsigned pos) const {
|
||||
return m_imp->get_symbol_array(pos);
|
||||
}
|
||||
|
||||
void ** z3_replayer::get_obj_array(unsigned pos) const {
|
||||
return m_imp->get_obj_array(pos);
|
||||
}
|
||||
|
||||
int * z3_replayer::get_int_addr(unsigned pos) {
|
||||
return m_imp->get_int_addr(pos);
|
||||
}
|
||||
|
||||
__int64 * z3_replayer::get_int64_addr(unsigned pos) {
|
||||
return m_imp->get_int64_addr(pos);
|
||||
}
|
||||
|
||||
unsigned * z3_replayer::get_uint_addr(unsigned pos) {
|
||||
return m_imp->get_uint_addr(pos);
|
||||
}
|
||||
|
||||
__uint64 * z3_replayer::get_uint64_addr(unsigned pos) {
|
||||
return m_imp->get_uint64_addr(pos);
|
||||
}
|
||||
|
||||
Z3_string * z3_replayer::get_str_addr(unsigned pos) {
|
||||
return m_imp->get_str_addr(pos);
|
||||
}
|
||||
|
||||
void ** z3_replayer::get_obj_addr(unsigned pos) {
|
||||
return m_imp->get_obj_addr(pos);
|
||||
}
|
||||
|
||||
void z3_replayer::store_result(void * obj) {
|
||||
return m_imp->store_result(obj);
|
||||
}
|
||||
|
||||
void z3_replayer::register_cmd(unsigned id, z3_replayer_cmd cmd) {
|
||||
return m_imp->register_cmd(id, cmd);
|
||||
}
|
||||
|
||||
void z3_replayer::parse() {
|
||||
return m_imp->parse();
|
||||
}
|
66
src/api/z3_replayer.h
Normal file
66
src/api/z3_replayer.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
z3_replayer.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Interpreter for Z3 logs
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-09-22
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _Z3_REPLAYER_H_
|
||||
#define _Z3_REPLAYER_H_
|
||||
|
||||
#include<iostream>
|
||||
#include"z3.h"
|
||||
#include"z3_exception.h"
|
||||
|
||||
class z3_replayer;
|
||||
|
||||
typedef void (*z3_replayer_cmd)(z3_replayer &);
|
||||
|
||||
typedef default_exception z3_replayer_exception;
|
||||
|
||||
class z3_replayer {
|
||||
struct imp;
|
||||
imp * m_imp;
|
||||
public:
|
||||
z3_replayer(std::istream & in);
|
||||
~z3_replayer();
|
||||
void parse();
|
||||
unsigned get_line() const;
|
||||
|
||||
int get_int(unsigned pos) const;
|
||||
unsigned get_uint(unsigned pos) const;
|
||||
__int64 get_int64(unsigned pos) const;
|
||||
__uint64 get_uint64(unsigned pos) const;
|
||||
double get_double(unsigned pos) const;
|
||||
bool get_bool(unsigned pos) const;
|
||||
Z3_string get_str(unsigned pos) const;
|
||||
Z3_symbol get_symbol(unsigned pos) const;
|
||||
void * get_obj(unsigned pos) const;
|
||||
|
||||
unsigned * get_uint_array(unsigned pos) const;
|
||||
Z3_symbol * get_symbol_array(unsigned pos) const;
|
||||
void ** get_obj_array(unsigned pos) const;
|
||||
|
||||
int * get_int_addr(unsigned pos);
|
||||
__int64 * get_int64_addr(unsigned pos);
|
||||
unsigned * get_uint_addr(unsigned pos);
|
||||
__uint64 * get_uint64_addr(unsigned pos);
|
||||
Z3_string * get_str_addr(unsigned pos);
|
||||
void ** get_obj_addr(unsigned pos);
|
||||
|
||||
void store_result(void * obj);
|
||||
void register_cmd(unsigned id, z3_replayer_cmd cmd);
|
||||
};
|
||||
|
||||
#endif
|
1304
src/api/z3_solver.cpp
Normal file
1304
src/api/z3_solver.cpp
Normal file
File diff suppressed because it is too large
Load diff
1007
src/api/z3_solver.h
Normal file
1007
src/api/z3_solver.h
Normal file
File diff suppressed because it is too large
Load diff
64
src/api/z3_v1.h
Normal file
64
src/api/z3_v1.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
z3_v1.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 1.x backwards compatibility macros.
|
||||
These macros are used to simulate the Z3 API using in the 1.x versions.
|
||||
This file should only be used by users still using the Z3 1.x API.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-09-22
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef _Z3_V1_H_
|
||||
#define _Z3_V1_H_
|
||||
|
||||
#include"z3.h"
|
||||
|
||||
// Backwards compatibility
|
||||
#define Z3_type_ast Z3_sort
|
||||
#define Z3_const_decl_ast Z3_func_decl
|
||||
#define Z3_const Z3_app
|
||||
#define Z3_pattern_ast Z3_pattern
|
||||
#define Z3_UNINTERPRETED_TYPE Z3_UNINTERPRETED_SORT
|
||||
#define Z3_BOOL_TYPE Z3_BOOL_SORT
|
||||
#define Z3_INT_TYPE Z3_INT_SORT
|
||||
#define Z3_REAL_TYPE Z3_REAL_SORT
|
||||
#define Z3_BV_TYPE Z3_BV_SORT
|
||||
#define Z3_ARRAY_TYPE Z3_ARRAY_SORT
|
||||
#define Z3_TUPLE_TYPE Z3_DATATYPE_SORT
|
||||
#define Z3_UNKNOWN_TYPE Z3_UNKNOWN_SORT
|
||||
#define Z3_CONST_DECL_AST Z3_FUNC_DECL_AST
|
||||
#define Z3_TYPE_AST Z3_SORT_AST
|
||||
#define Z3_SORT_ERROR Z3_TYPE_ERROR
|
||||
#define Z3_mk_uninterpreted_type Z3_mk_uninterpreted_sort
|
||||
#define Z3_mk_bool_type Z3_mk_bool_sort
|
||||
#define Z3_mk_int_type Z3_mk_int_sort
|
||||
#define Z3_mk_real_type Z3_mk_real_sort
|
||||
#define Z3_mk_bv_type Z3_mk_bv_sort
|
||||
#define Z3_mk_array_type Z3_mk_array_sort
|
||||
#define Z3_mk_tuple_type Z3_mk_tuple_sort
|
||||
#define Z3_get_type Z3_get_sort
|
||||
#define Z3_get_pattern_ast Z3_get_pattern
|
||||
#define Z3_get_type_kind Z3_get_sort_kind
|
||||
#define Z3_get_type_name Z3_get_sort_name
|
||||
#define Z3_get_bv_type_size Z3_get_bv_sort_size
|
||||
#define Z3_get_array_type_domain Z3_get_array_sort_domain
|
||||
#define Z3_get_array_type_range Z3_get_array_sort_range
|
||||
#define Z3_get_tuple_type_num_fields Z3_get_tuple_sort_num_fields
|
||||
#define Z3_get_tuple_type_field_decl Z3_get_tuple_sort_field_decl
|
||||
#define Z3_get_tuple_type_mk_decl Z3_get_tuple_sort_mk_decl
|
||||
#define Z3_to_const_ast Z3_to_app
|
||||
#define Z3_get_numeral_value_string Z3_get_numeral_string
|
||||
#define Z3_get_const_ast_decl Z3_get_app_decl
|
||||
#define Z3_get_value Z3_eval_func_decl
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue