join_fn(sieve_relation_plugin & p, const relation_base & r1, const relation_base & r2, unsigned col_cnt, const unsigned * cols1, const unsigned * cols2, relation_join_fn * inner_join_fun) : convenient_relation_join_fn(r1.get_signature(), r2.get_signature(), col_cnt, cols1, cols2), m_plugin(p), m_inner_join_fun(inner_join_fun) { bool r1_sieved = r1.get_plugin().is_sieve_relation(); bool r2_sieved = r2.get_plugin().is_sieve_relation(); const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : 0; const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : 0; if(r1_sieved) { m_result_inner_cols.append(sr1->m_inner_cols); } else { m_result_inner_cols.resize(r1.get_signature().size(), true); } if(r2_sieved) { m_result_inner_cols.append(sr2->m_inner_cols); } else { m_result_inner_cols.resize(m_result_inner_cols.size() + r2.get_signature().size(), true); } }
void operator()(expr * e) { if (is_app(e)) { func_decl * sym = to_app(e)->get_decl(); unsigned idx; if (m_parent.try_get_index(sym, idx)) { SASSERT(idx > 0); --idx; if (m_indices.size() <= idx) { m_indices.resize(idx + 1, false); } m_indices[idx] = true; } } }
static bool iZ3_parse(Z3_context ctx, const char *filename, const char **error, svector<Z3_ast> &assertions){ read_error.clear(); try { std::string foo(filename); if (foo.size() >= 5 && foo.substr(foo.size() - 5) == ".smt2"){ Z3_ast assrts = Z3_parse_smtlib2_file(ctx, filename, 0, 0, 0, 0, 0, 0); Z3_app app = Z3_to_app(ctx, assrts); int nconjs = Z3_get_app_num_args(ctx, app); assertions.resize(nconjs); for (int k = 0; k < nconjs; k++) assertions[k] = Z3_get_app_arg(ctx, app, k); } else { Z3_parse_smtlib_file(ctx, filename, 0, 0, 0, 0, 0, 0); int numa = Z3_get_smtlib_num_assumptions(ctx); int numf = Z3_get_smtlib_num_formulas(ctx); int num = numa + numf; assertions.resize(num); for (int j = 0; j < num; j++){ if (j < numa) assertions[j] = Z3_get_smtlib_assumption(ctx, j); else assertions[j] = Z3_get_smtlib_formula(ctx, j - numa); } } } catch (...) { read_error << "SMTLIB parse error: " << Z3_get_smtlib_error(ctx); read_msg = read_error.str(); *error = read_msg.c_str(); return false; } Z3_set_error_handler(ctx, 0); return true; }
line_reader(const char * fname) :m_eof(false), m_eof_behind_buffer(false), m_next_index(0), m_ok(true), m_data_size(0) { m_data.resize(2*s_expansion_step); resize_data(0); #if _WINDOWS errno_t err = fopen_s(&m_file, fname, "rb"); m_ok = (m_file != NULL) && (err == 0); #else m_file = fopen(fname, "rb"); m_ok = (m_file != NULL); #endif }
void resize_data(unsigned sz) { m_data_size = sz; m_data.resize(m_data_size+1); m_data[m_data_size] = s_delimiter; }