コード例 #1
0
ファイル: pack_domain.cpp プロジェクト: avigad/lean
 expr operator()(expr const & e) {
     unpack_eqns ues(m_ctx, e);
     buffer<expr> old_fns;
     bool modified = false;
     for (unsigned fidx = 0; fidx < ues.get_num_fns(); fidx++) {
         expr const & fn = ues.get_fn(fidx);
         old_fns.push_back(fn);
         unsigned arity = ues.get_arity_of(fidx);
         if (arity > 1) {
             expr new_type = pack_as_unary(m_ctx.infer(fn), arity);
             ues.update_fn_type(fidx, new_type);
             modified = true;
         }
     }
     if (!modified) return e;
     update_apps_fn updt(m_ctx, old_fns, ues);
     for (unsigned fidx = 0; fidx < ues.get_num_fns(); fidx++) {
         buffer<expr> & eqs = ues.get_eqns_of(fidx);
         for (expr & eq : eqs)
             eq = updt(eq);
     }
     expr r = ues.repack();
     lean_trace("eqn_compiler", tout() << "making function(s) unary:\n" << r << "\n";);
コード例 #2
0
ファイル: main_window.cpp プロジェクト: sje397/QtBugs
void MainWindow::load_world() {
    if(changed) {
        int ret = QMessageBox::warning(this, tr("Bugs"), tr("Save changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save);
        if(ret == QMessageBox::Cancel) return;
        else if(ret == QMessageBox::Save) save_world();
        else if(ret != QMessageBox::Discard) return; // in case of pressing escape
    }

    bool running = false;
    if(isRunning()) {
        stop();
        running = true;
    }

    QString fn = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("Bug data (*.bug)"));
    if(fn.isEmpty()) return;

    load_from_file(fn, running);

    if(running) start();
    else updt();
}