Exemplo n.º 1
0
void grobner::assert_eq(expr * eq, v_dependency * ex) {
    SASSERT(m_manager.is_eq(eq));
    expr * lhs = to_app(eq)->get_arg(0);
    expr * rhs = to_app(eq)->get_arg(1);
    SASSERT(m_util.is_numeral(rhs));
    ptr_buffer<expr> monomials;
    extract_monomials(lhs, monomials);
    rational c;
    bool is_int = false;
    m_util.is_numeral(rhs, c, is_int);
    expr_ref new_c(m_manager);
    if (!c.is_zero()) {
        c.neg();
        new_c = m_util.mk_numeral(c, is_int);
        monomials.push_back(new_c);
    }
    assert_eq_0(monomials.size(), monomials.c_ptr(), ex);
}
Exemplo n.º 2
0
int main () {
    cout << "begin main" << endl;
    lt_dlhandle _dl_c;
    NEW_C new_c;
    DEL_C del_c;
    c *_c;

    lt_dlinit ();

    _dl_c = lt_dlopen ("./c.so");
    if (! _dl_c) {
        cout << "lt_dlopen ./c.so failed" << endl;
        return -1;
    }

    new_c = (NEW_C) lt_dlsym (_dl_c, "new_c");
    if (! new_c) { 
        cout << "lt_dlsym failed: " << lt_dlerror () << endl;
        return -2;
    }

    del_c = (DEL_C) lt_dlsym (_dl_c, "del_c");
    if (! del_c) {
        cout << "lt_dlsym failed: " << lt_dlerror () << endl;
        return -3;
    }

    new_c (&_c, 5);

    _c->print_x ();

    cout << "_c->x = 10" << endl;
    _c->x = 10;

    _c->print_x ();

    del_c (_c);

    lt_dlclose (_dl_c);
    lt_dlexit ();

    cout << "end main" << endl;
    return 0;
}