int process_bch(config const & config) { FILE * fin = nullptr; string filename = config.get_filename(); // Make sure file exists if ((fin = fopen(filename.c_str(), "rt")) == nullptr) { opensmt_error2("can't open file", filename.c_str()); } ::bchset_in(fin); ::bch_init_parser(); ::bchparse(); OpenSMTContext & ctx = *bch_ctx; if (config.get_precision() > 0) { ctx.setPrecision(config.get_precision()); } ctx.setLocalOpt(config.get_local_opt()); ctx.setDebug(config.get_debug()); ctx.setPolytope(config.get_polytope()); ctx.setShrinkForDop(config.get_sync()); unordered_map<string, Enode *> var_map = bch_var_map; vector<Enode *> & costs = bch_costs; vector<Enode *> & ctrs_X = bch_ctrs; int const ret = process_main(ctx, config, costs, var_map, ctrs_X); ::bchlex_destroy(); fclose(fin); ::bch_cleanup_parser(); return ret; }
int process_inv(config const & config) { FILE * fin = nullptr; string filename = config.get_filename(); // Make sure file exists if ((fin = fopen(filename.c_str(), "rt")) == nullptr) { opensmt_error2("can't open file", filename.c_str()); } ::invset_in(fin); ::inv_init_parser(); ::invparse(); OpenSMTContext & ctx = *inv_ctx; if (inv_prec > 0) { ctx.setPrecision(inv_prec); } if (config.get_precision() > 0) { ctx.setPrecision(config.get_precision()); } int const ret = process_main(ctx, config); ::invlex_destroy(); fclose(fin); ::inv_cleanup_parser(); return ret; }