mirror of
https://github.com/Z3Prover/z3
synced 2025-04-13 12:28:44 +00:00
parent
c7bbf2f8de
commit
5bc0fb47a8
|
@ -55,6 +55,20 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Z3_ast Z3_API Z3_mk_lstring(Z3_context c, unsigned sz, Z3_string str) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_string(c, str);
|
||||
RESET_ERROR_CODE();
|
||||
unsigned_vector chs;
|
||||
for (unsigned i = 0; i < sz; ++i) chs.push_back(str[i]);
|
||||
zstring s(sz, chs.c_ptr(), zstring::ascii);
|
||||
app* a = mk_c(c)->sutil().str.mk_string(s);
|
||||
mk_c(c)->save_ast_trail(a);
|
||||
RETURN_Z3(of_ast(a));
|
||||
Z3_CATCH_RETURN(nullptr);
|
||||
}
|
||||
|
||||
Z3_sort Z3_API Z3_mk_string_sort(Z3_context c) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_mk_string_sort(c);
|
||||
|
|
|
@ -10006,7 +10006,7 @@ def is_string_value(a):
|
|||
def StringVal(s, ctx=None):
|
||||
"""create a string expression"""
|
||||
ctx = _get_ctx(ctx)
|
||||
return SeqRef(Z3_mk_string(ctx.ref(), s), ctx)
|
||||
return SeqRef(Z3_mk_lstring(ctx.ref(), len(s), s), ctx)
|
||||
|
||||
def String(name, ctx=None):
|
||||
"""Return a string constant named `name`. If `ctx=None`, then the global context is used.
|
||||
|
|
|
@ -3327,6 +3327,15 @@ extern "C" {
|
|||
*/
|
||||
Z3_ast Z3_API Z3_mk_string(Z3_context c, Z3_string s);
|
||||
|
||||
/**
|
||||
\brief Create a string constant out of the string that is passed in
|
||||
It takes the length of the string as well to take into account
|
||||
0 characters.
|
||||
|
||||
def_API('Z3_mk_lstring' ,AST ,(_in(CONTEXT), _in(UINT), _in(STRING)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_mk_lstring(Z3_context c, unsigned len, Z3_string s);
|
||||
|
||||
/**
|
||||
\brief Determine if \c s is a string constant.
|
||||
|
||||
|
|
Loading…
Reference in a new issue