Ejemplo n.º 1
0
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;
}